Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
836f3e4c
Commit
836f3e4c
authored
Dec 12, 2012
by
Jason Edmeades
Committed by
Alexandre Julliard
Dec 21, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cmd: Convert the set /a tests to validate better.
parent
82888274
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
176 additions
and
138 deletions
+176
-138
test_builtins.cmd
programs/cmd/tests/test_builtins.cmd
+95
-72
test_builtins.cmd.exp
programs/cmd/tests/test_builtins.cmd.exp
+81
-66
No files found.
programs/cmd/tests/test_builtins.cmd
View file @
836f3e4c
...
@@ -1030,85 +1030,108 @@ for /L %%i in (2,2,1) do (
...
@@ -1030,85 +1030,108 @@ for /L %%i in (2,2,1) do (
echo %%i
echo %%i
echo FAILED
echo FAILED
)
)
echo --- for /a
echo --- set /a
goto :testseta
Rem Ideally for /f can be used rather than building a command to execute
rem but that does not work on NT4
:checkenvvars
if "%1"=="" goto :eof
call :executecmd set wine_result=%%%1%%
if "%wine_result%"=="%2" (
echo %1 correctly %2
) else echo ERROR: %1 incorrectly %wine_result% [%2]
set %1=
shift
shift
rem shift
goto :checkenvvars
:executecmd
%*
goto :eof
:testseta
rem No output when using "set expr" syntax, unless in interactive mode
rem No output when using "set expr" syntax, unless in interactive mode
rem Need to use "set envvar=expr" to use in a batch script
rem Need to use "set envvar=expr" to use in a batch script
echo ------ individual operations
echo ------ individual operations
set WINE_
var
=0
set WINE_
foo
=0
set /a WINE_
var=1 +2 & echo %WINE_var%
set /a WINE_
foo=1 +2 & call :checkenvvars WINE_foo 3
set /a WINE_
var=1 +-2 & echo %WINE_var%
set /a WINE_
foo=1 +-2 & call :checkenvvars WINE_foo -1
set /a WINE_
var=1 --2 & echo %WINE_var%
set /a WINE_
foo=1 --2 & call :checkenvvars WINE_foo 3
set /a WINE_
var=2* 3 & echo %WINE_var%
set /a WINE_
foo=2* 3 & call :checkenvvars WINE_foo 6
set /a WINE_
var=-2* -5 & echo %WINE_var%
set /a WINE_
foo=-2* -5 & call :checkenvvars WINE_foo 10
set /a WINE_
var=12/3 & echo %WINE_var%
set /a WINE_
foo=12/3 & call :checkenvvars WINE_foo 4
set /a WINE_
var=13/3 & echo %WINE_var%
set /a WINE_
foo=13/3 & call :checkenvvars WINE_foo 4
set /a WINE_
var=-13/3 & echo %WINE_var%
set /a WINE_
foo=-13/3 & call :checkenvvars WINE_foo -4
rem FIXME Divide by zero should return an error, but error messages cannot be tested with current infrastructure
rem FIXME Divide by zero should return an error, but error messages cannot be tested with current infrastructure
set /a WINE_
var=5 %% 5 & echo %WINE_var%
set /a WINE_
foo=5 %% 5 & call :checkenvvars WINE_foo 0
set /a WINE_
var=5 %% 3 & echo %WINE_var%
set /a WINE_
foo=5 %% 3 & call :checkenvvars WINE_foo 2
set /a WINE_
var=5 %% -3 & echo %WINE_var%
set /a WINE_
foo=5 %% -3 & call :checkenvvars WINE_foo 2
set /a WINE_
var=-5 %% -3 & echo %WINE_var%
set /a WINE_
foo=-5 %% -3 & call :checkenvvars WINE_foo -2
set /a WINE_
var=1 ^<^< 0 & echo %WINE_var%
set /a WINE_
foo=1 ^<^< 0 & call :checkenvvars WINE_foo 1
set /a WINE_
var=1 ^<^< 2 & echo %WINE_var%
set /a WINE_
foo=1 ^<^< 2 & call :checkenvvars WINE_foo 4
set /a WINE_
var=1 ^<^< -2 & echo %WINE_var%
set /a WINE_
foo=1 ^<^< -2 & call :checkenvvars WINE_foo 0
set /a WINE_
var=-1 ^<^< -2 & echo %WINE_var%
set /a WINE_
foo=-1 ^<^< -2 & call :checkenvvars WINE_foo 0
set /a WINE_
var=-1 ^<^< 2 & echo %WINE_var%
set /a WINE_
foo=-1 ^<^< 2 & call :checkenvvars WINE_foo -4
set /a WINE_
var=9 ^>^> 0 & echo %WINE_var%
set /a WINE_
foo=9 ^>^> 0 & call :checkenvvars WINE_foo 9
set /a WINE_
var=9 ^>^> 2 & echo %WINE_var%
set /a WINE_
foo=9 ^>^> 2 & call :checkenvvars WINE_foo 2
set /a WINE_
var=9 ^>^> -2 & echo %WINE_var%
set /a WINE_
foo=9 ^>^> -2 & call :checkenvvars WINE_foo 0
set /a WINE_
var=-9 ^>^> -2 & echo %WINE_var%
set /a WINE_
foo=-9 ^>^> -2 & call :checkenvvars WINE_foo -1
set /a WINE_
var=-9 ^>^> 2 & echo %WINE_var%
set /a WINE_
foo=-9 ^>^> 2 & call :checkenvvars WINE_foo -3
set /a WINE_
var=5 ^& 0 & echo %WINE_var%
set /a WINE_
foo=5 ^& 0 & call :checkenvvars WINE_foo 0
set /a WINE_
var=5 ^& 1 & echo %WINE_var%
set /a WINE_
foo=5 ^& 1 & call :checkenvvars WINE_foo 1
set /a WINE_
var=5 ^& 3 & echo %WINE_var%
set /a WINE_
foo=5 ^& 3 & call :checkenvvars WINE_foo 1
set /a WINE_
var=5 ^& 4 & echo %WINE_var%
set /a WINE_
foo=5 ^& 4 & call :checkenvvars WINE_foo 4
set /a WINE_
var=5 ^& 1 & echo %WINE_var%
set /a WINE_
foo=5 ^& 1 & call :checkenvvars WINE_foo 1
set /a WINE_
var=5 ^| 0 & echo %WINE_var%
set /a WINE_
foo=5 ^| 0 & call :checkenvvars WINE_foo 5
set /a WINE_
var=5 ^| 1 & echo %WINE_var%
set /a WINE_
foo=5 ^| 1 & call :checkenvvars WINE_foo 5
set /a WINE_
var=5 ^| 3 & echo %WINE_var%
set /a WINE_
foo=5 ^| 3 & call :checkenvvars WINE_foo 7
set /a WINE_
var=5 ^| 4 & echo %WINE_var%
set /a WINE_
foo=5 ^| 4 & call :checkenvvars WINE_foo 5
set /a WINE_
var=5 ^| 1 & echo %WINE_var%
set /a WINE_
foo=5 ^| 1 & call :checkenvvars WINE_foo 5
set /a WINE_
var=5 ^^ 0 & echo %WINE_var%
set /a WINE_
foo=5 ^^ 0 & call :checkenvvars WINE_foo 5
set /a WINE_
var=5 ^^ 1 & echo %WINE_var%
set /a WINE_
foo=5 ^^ 1 & call :checkenvvars WINE_foo 4
set /a WINE_
var=5 ^^ 3 & echo %WINE_var%
set /a WINE_
foo=5 ^^ 3 & call :checkenvvars WINE_foo 6
set /a WINE_
var=5 ^^ 4 & echo %WINE_var%
set /a WINE_
foo=5 ^^ 4 & call :checkenvvars WINE_foo 1
set /a WINE_
var=5 ^^ 1 & echo %WINE_var%
set /a WINE_
foo=5 ^^ 1 & call :checkenvvars WINE_foo 4
echo ------ precedence and grouping
echo ------ precedence and grouping
set /a WINE_
var=4 + 2*3 & echo %WINE_var%
set /a WINE_
foo=4 + 2*3 & call :checkenvvars WINE_foo 10
set /a WINE_
var=(4+2)*3 & echo %WINE_var%
set /a WINE_
foo=(4+2)*3 & call :checkenvvars WINE_foo 18
set /a WINE_
var=4 * 3/5 & echo %WINE_var%
set /a WINE_
foo=4 * 3/5 & call :checkenvvars WINE_foo 2
set /a WINE_
var=(4 * 3)/5 & echo %WINE_var%
set /a WINE_
foo=(4 * 3)/5 & call :checkenvvars WINE_foo 2
set /a WINE_
var=4 * 5 %% 4 & echo %WINE_var%
set /a WINE_
foo=4 * 5 %% 4 & call :checkenvvars WINE_foo 0
set /a WINE_
var=4 * (5 %% 4) & echo %WINE_var%
set /a WINE_
foo=4 * (5 %% 4) & call :checkenvvars WINE_foo 4
set /a WINE_
var=3 %% (5 + 8 %% 3 ^^ 2) & echo %WINE_var%
set /a WINE_
foo=3 %% (5 + 8 %% 3 ^^ 2) & call :checkenvvars WINE_foo 3
set /a WINE_
var=3 %% (5 + 8 %% 3 ^^ -2) & echo %WINE_var%
set /a WINE_
foo=3 %% (5 + 8 %% 3 ^^ -2) & call :checkenvvars WINE_foo 3
echo ------ octal and hexadecimal
echo ------ octal and hexadecimal
set /a WINE_
var=0xf + 3 & echo %WINE_var%
set /a WINE_
foo=0xf + 3 & call :checkenvvars WINE_foo 18
set /a WINE_
var=0xF + 3 & echo %WINE_var%
set /a WINE_
foo=0xF + 3 & call :checkenvvars WINE_foo 18
set /a WINE_
var=015 + 2 & echo %WINE_var%
set /a WINE_
foo=015 + 2 & call :checkenvvars WINE_foo 15
set /a WINE_
var=3, 8+3,0 & echo %WINE_var%
set /a WINE_
foo=3, 8+3,0 & call :checkenvvars WINE_foo 3
echo ------ variables
echo ------ variables
set /a WINE_var=WINE_foo=3, WINE_foo+1 & echo %WINE_var%
set /a WINE_foo=WINE_bar=3, WINE_bar+1 & call :checkenvvars WINE_foo 3 WINE_bar 3
if defined WINE_foo (echo %WINE_foo%) else (
set /a WINE_foo=WINE_bar=3, WINE_bar+=1 & call :checkenvvars WINE_foo 3 WINE_bar 4
echo WINE_foo not defined
set /a WINE_foo=WINE_bar=3, WINE_baz=1, WINE_baz+=WINE_bar, WINE_baz & call :checkenvvars WINE_foo 3 WINE_bar 3 WINE_baz 4
)
set WINE_bar=3
set /a WINE_var=WINE_foo=3, WINE_foo+=1 & echo %WINE_var%
set /a WINE_foo=WINE_bar*= WINE_bar & call :checkenvvars WINE_foo 9 WINE_bar 9
set /a WINE_var=WINE_foo=3, WINE_bar=1, WINE_bar+=WINE_foo, WINE_bar & echo %WINE_var%
set /a WINE_foo=WINE_whateverNonExistingVar & call :checkenvvars WINE_foo 0
set /a WINE_var=WINE_foo*= WINE_foo & echo %WINE_var%
set WINE_bar=4
set /a WINE_var=WINE_whateverNonExistingVar & echo %WINE_var%
set /a WINE_foo=WINE_whateverNonExistingVar + WINE_bar & call :checkenvvars WINE_foo 4 WINE_bar 4
set /a WINE_var=WINE_whateverNonExistingVar + WINE_bar & echo %WINE_var%
set WINE_bar=4
set /a WINE_var=WINE_foo -= WINE_foo + 7 & echo %WINE_var%
set /a WINE_foo=WINE_bar -= WINE_bar + 7 & call :checkenvvars WINE_foo -7 WINE_bar -7
set /a WINE_var=WINE_foo /= 3 + 2 & echo %WINE_var%
set WINE_bar=-7
set /a WINE_var=WINE_foo=5, WINE_foo %%=2 & echo %WINE_var%
set /a WINE_foo=WINE_bar /= 3 + 2 & call :checkenvvars WINE_foo -1 WINE_bar -1
set /a WINE_var=WINE_foo ^<^<= 2 & echo %WINE_var%
set /a WINE_foo=WINE_bar=5, WINE_bar %%=2 & call :checkenvvars WINE_foo 5 WINE_bar 1
set /a WINE_var=WINE_foo ^>^>= 2 & echo %WINE_var%
set WINE_bar=1
set /a WINE_var=WINE_foo ^&= 2 & echo %WINE_var%
set /a WINE_foo=WINE_bar ^<^<= 2 & call :checkenvvars WINE_foo 4 WINE_bar 4
set /a WINE_var=WINE_foo=5, WINE_foo ^|= 2 & echo %WINE_var%
set WINE_bar=4
set /a WINE_var=WINE_foo=5, WINE_foo ^^= 2 & echo %WINE_var%
set /a WINE_foo=WINE_bar ^>^>= 2 & call :checkenvvars WINE_foo 1 WINE_bar 1
set /a WINE_var=WINE_foo=19, WINE_foo %%= 4 + (WINE_bar %%= 7) & echo.
set WINE_bar=1
set WINE_foo=
set /a WINE_foo=WINE_bar ^&= 2 & call :checkenvvars WINE_foo 0 WINE_bar 0
set WINE_bar=
set /a WINE_foo=WINE_bar=5, WINE_bar ^|= 2 & call :checkenvvars WINE_foo 5 WINE_bar 7
set WINE_var=
set /a WINE_foo=WINE_bar=5, WINE_bar ^^= 2 & call :checkenvvars WINE_foo 5 WINE_bar 7
set WINE_baz=4
set /a WINE_foo=WINE_bar=19, WINE_bar %%= 4 + (WINE_baz %%= 7) & call :checkenvvars WINE_foo 19 WINE_bar 3 WINE_baz 4
echo --- for /F
echo --- for /F
mkdir foobar & cd foobar
mkdir foobar & cd foobar
echo ------ string argument
echo ------ string argument
...
...
programs/cmd/tests/test_builtins.cmd.exp
View file @
836f3e4c
...
@@ -715,76 +715,91 @@ ErrorLevel 0
...
@@ -715,76 +715,91 @@ ErrorLevel 0
-1
-1
1
1
3
3
---
for
/a
---
set
/a
------ individual operations
------ individual operations
0
@todo_wine@WINE_foo correctly 3
@todo_wine@
3
@todo_wine@
WINE_foo correctly -1
@todo_wine@
-1
@todo_wine@
WINE_foo correctly 3
@todo_wine@
3
@todo_wine@
WINE_foo correctly 6
@todo_wine@
6
@todo_wine@
WINE_foo correctly 10
@todo_wine@
10
@todo_wine@
WINE_foo correctly 4
@todo_wine@4
@todo_wine@
WINE_foo correctly
4
@todo_wine@4
@todo_wine@
WINE_foo correctly -
4
@todo_wine@
-4
@todo_wine@
WINE_foo correctly 0
0
@todo_wine@WINE_foo correctly 2
@todo_wine@2
@todo_wine@
WINE_foo correctly
2
@todo_wine@2
@todo_wine@
WINE_foo correctly -
2
@todo_wine@
-2
@todo_wine@
WINE_foo correctly 1
@todo_wine@
1
@todo_wine@
WINE_foo correctly 4
@todo_wine@
4
@todo_wine@
WINE_foo correctly 0@or_broken@ERROR: WINE_foo incorrectly 1073741824 [0]
0@or_broken@1073741824
@todo_wine@WINE_foo correctly 0@or_broken@ERROR: WINE_foo incorrectly -1073741824 [0]
0@or_broken@-107374182
4
@todo_wine@WINE_foo correctly -
4
@todo_wine@
-4
@todo_wine@
WINE_foo correctly 9
@todo_wine@
9
@todo_wine@
WINE_foo correctly 2
@todo_wine@
2
@todo_wine@
WINE_foo correctly 0
0
@todo_wine@WINE_foo correctly -1
@todo_wine@
-1
@todo_wine@
WINE_foo correctly -3
@todo_wine@
-3
@todo_wine@
WINE_foo correctly 0
0
@todo_wine@WINE_foo correctly 1
@todo_wine@1
@todo_wine@
WINE_foo correctly
1
@todo_wine@
1
@todo_wine@
WINE_foo correctly 4
@todo_wine@
4
@todo_wine@
WINE_foo correctly 1
@todo_wine@
1
@todo_wine@
WINE_foo correctly 5
@todo_wine@5
@todo_wine@
WINE_foo correctly
5
@todo_wine@
5
@todo_wine@
WINE_foo correctly 7
@todo_wine@
7
@todo_wine@
WINE_foo correctly 5
@todo_wine@5
@todo_wine@
WINE_foo correctly
5
@todo_wine@5
@todo_wine@
WINE_foo correctly
5
@todo_wine@
5
@todo_wine@
WINE_foo correctly 4
@todo_wine@
4
@todo_wine@
WINE_foo correctly 6
@todo_wine@
6
@todo_wine@
WINE_foo correctly 1
@todo_wine@
1
@todo_wine@
WINE_foo correctly 4
------ precedence and grouping
------ precedence and grouping
@todo_wine@
4
@todo_wine@
WINE_foo correctly 10
@todo_wine@
10
@todo_wine@
WINE_foo correctly 18@or_broken@ERROR: WINE_foo incorrectly [18]
@todo_wine@
18@or_broken@10
@todo_wine@
WINE_foo correctly 2@or_broken@ERROR: WINE_foo incorrectly 0 [2]
@todo_wine@
2@or_broken@0
@todo_wine@
WINE_foo correctly 2@or_broken@ERROR: WINE_foo incorrectly [2]
@todo_wine@
2@or_broken@0
@todo_wine@
WINE_foo correctly 0@or_broken@ERROR: WINE_foo incorrectly 4 [0]
0@or_broken@4
@todo_wine@WINE_foo correctly 4@or_broken@ERROR: WINE_foo incorrectly [4]
@todo_wine@
4
@todo_wine@
WINE_foo correctly 3@or_broken@ERROR: WINE_foo incorrectly [3]
@todo_wine@
3@or_broken@4
@todo_wine@
WINE_foo correctly 3@or_broken@ERROR: WINE_foo incorrectly [3]
------ octal and hexadecimal
------ octal and hexadecimal
@todo_wine@
3@or_broken@4
@todo_wine@
WINE_foo correctly 18
@todo_wine@18
@todo_wine@
WINE_foo correctly
18
@todo_wine@
18
@todo_wine@
WINE_foo correctly 15
@todo_wine@
15
@todo_wine@
WINE_foo correctly 3
------ variables
------ variables
@todo_wine@3
@todo_wine@WINE_foo correctly 3@or_broken@ERROR: WINE_foo incorrectly 0 [3]
@todo_wine@3@or_broken@WINE_foo not defined
@todo_wine@WINE_bar correctly 3@or_broken@ERROR: WINE_bar incorrectly [3]
@todo_wine@3@or_broken@0
@todo_wine@WINE_foo correctly 3@or_broken@ERROR: WINE_foo incorrectly 0 [3]
@todo_wine@3@or_broken@0
@todo_wine@WINE_bar correctly 4@or_broken@ERROR: WINE_bar incorrectly [4]
@todo_wine@3@or_broken@0
@todo_wine@WINE_foo correctly 3@or_broken@ERROR: WINE_foo incorrectly 0 [3]
@todo_wine@9@or_broken@0
@todo_wine@WINE_bar correctly 3@or_broken@ERROR: WINE_bar incorrectly [3]
0
@todo_wine@WINE_baz correctly 4@or_broken@ERROR: WINE_baz incorrectly [4]
@todo_wine@4@or_broken@0
@todo_wine@WINE_foo correctly 9@or_broken@ERROR: WINE_foo incorrectly 3 [9]
@todo_wine@-7@or_broken@0
@todo_wine@WINE_bar correctly 9@or_broken@ERROR: WINE_bar incorrectly 3 [9]
@todo_wine@-1@or_broken@0
@todo_wine@WINE_foo correctly 0
@todo_wine@5@or_broken@0
@todo_wine@WINE_foo correctly 4
@todo_wine@4@or_broken@0
WINE_bar correctly 4
@todo_wine@1@or_broken@0
@todo_wine@WINE_foo correctly -7@or_broken@ERROR: WINE_foo incorrectly 4 [-7]
0
@todo_wine@WINE_bar correctly -7@or_broken@ERROR: WINE_bar incorrectly 4 [-7]
@todo_wine@5@or_broken@0
@todo_wine@WINE_foo correctly -1@or_broken@ERROR: WINE_foo incorrectly -7 [-1]
@todo_wine@WINE_bar correctly -1@or_broken@ERROR: WINE_bar incorrectly -7 [-1]
@todo_wine@WINE_foo correctly 5@or_broken@ERROR: WINE_foo incorrectly 0 [5]
@todo_wine@WINE_bar correctly 1@or_broken@ERROR: WINE_bar incorrectly [1]
@todo_wine@WINE_foo correctly 4@or_broken@ERROR: WINE_foo incorrectly 1 [4]
@todo_wine@WINE_bar correctly 4@or_broken@ERROR: WINE_bar incorrectly 1 [4]
@todo_wine@WINE_foo correctly 1@or_broken@ERROR: WINE_foo incorrectly 4 [1]
@todo_wine@WINE_bar correctly 1@or_broken@ERROR: WINE_bar incorrectly 4 [1]
@todo_wine@WINE_foo correctly 0@or_broken@ERROR: WINE_foo incorrectly 1 [0]
@todo_wine@WINE_bar correctly 0@or_broken@ERROR: WINE_bar incorrectly 1 [0]
@todo_wine@WINE_foo correctly 5@or_broken@ERROR: WINE_foo incorrectly 0 [5]
@todo_wine@WINE_bar correctly 7@or_broken@ERROR: WINE_bar incorrectly [7]
@todo_wine@WINE_foo correctly 5@or_broken@ERROR: WINE_foo incorrectly 0 [5]
@todo_wine@WINE_bar correctly 7@or_broken@ERROR: WINE_bar incorrectly [7]
@todo_wine@WINE_foo correctly 19@or_broken@ERROR: WINE_foo incorrectly 0 [19]
@todo_wine@WINE_bar correctly 3@or_broken@ERROR: WINE_bar incorrectly [3]
WINE_baz correctly 4
--- for /F
--- for /F
------ string argument
------ string argument
a
a
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment