tangled
alpha
login
or
join now
huwcampbell.com
/
reactos
0
fork
atom
Reactos
0
fork
atom
overview
issues
pulls
pipelines
[CMD_ROSTEST] Add tests for SET /A errorlevels.
Hermès Bélusca-Maïto
5 years ago
f5cf67f4
87a54033
+85
2 changed files
expand all
collapse all
unified
split
modules
rostests
win32
cmd
test_builtins.cmd
test_builtins.cmd.exp
+56
modules/rostests/win32/cmd/test_builtins.cmd
···
498
498
:continue
499
499
500
500
501
501
+
:: Testing different ERRORLEVELs from the SET command.
502
502
+
:: See https://ss64.com/nt/set.html for more details.
503
503
+
504
504
+
echo ---------- Testing SET /A ERRORLEVELs ----------
505
505
+
506
506
+
echo --- Success
507
507
+
call :setError 0
508
508
+
set /a "total=1+1"
509
509
+
call :checkErrorLevel 0
510
510
+
echo %errorlevel%
511
511
+
echo %total%
512
512
+
513
513
+
echo --- Unbalanced parentheses
514
514
+
call :setError 0
515
515
+
set /a "total=(2+1"
516
516
+
call :checkErrorLevel 1073750988
517
517
+
echo %errorlevel%
518
518
+
echo %total%
519
519
+
520
520
+
echo --- Missing operand
521
521
+
call :setError 0
522
522
+
set /a "total=5*"
523
523
+
call :checkErrorLevel 1073750989
524
524
+
echo %errorlevel%
525
525
+
echo %total%
526
526
+
527
527
+
echo --- Syntax error
528
528
+
call :setError 0
529
529
+
set /a "total=7$3"
530
530
+
call :checkErrorLevel 1073750990
531
531
+
echo %errorlevel%
532
532
+
echo %total%
533
533
+
534
534
+
echo --- Invalid number
535
535
+
call :setError 0
536
536
+
set /a "total=0xdeadbeeg"
537
537
+
call :checkErrorLevel 1073750991
538
538
+
echo %errorlevel%
539
539
+
echo %total%
540
540
+
541
541
+
echo --- Number larger than 32-bits
542
542
+
call :setError 0
543
543
+
set /a "total=999999999999999999999999"
544
544
+
call :checkErrorLevel 1073750992
545
545
+
echo %errorlevel%
546
546
+
echo %total%
547
547
+
548
548
+
echo --- Division by zero
549
549
+
call :setError 0
550
550
+
set /a "total=1/0"
551
551
+
call :checkErrorLevel 1073750993
552
552
+
echo %errorlevel%
553
553
+
echo %total%
554
554
+
555
555
+
556
556
+
501
557
::
502
558
:: Finished!
503
559
::
+29
modules/rostests/win32/cmd/test_builtins.cmd.exp
···
130
130
0
131
131
0
132
132
0
133
133
+
---------- Testing SET /A ERRORLEVELs ----------
134
134
+
--- Success
135
135
+
OK
136
136
+
0
137
137
+
2
138
138
+
--- Unbalanced parentheses
139
139
+
OK
140
140
+
1073750988
141
141
+
2
142
142
+
--- Missing operand
143
143
+
OK
144
144
+
1073750989
145
145
+
2
146
146
+
--- Syntax error
147
147
+
OK
148
148
+
1073750990
149
149
+
7
150
150
+
--- Invalid number
151
151
+
OK
152
152
+
1073750991
153
153
+
7
154
154
+
--- Number larger than 32-bits
155
155
+
OK
156
156
+
1073750992
157
157
+
7
158
158
+
--- Division by zero
159
159
+
OK
160
160
+
1073750993
161
161
+
7
133
162
--------- Finished --------------