Skip to content

Commit 8615527

Browse files
committed
Adjusted test cases for tool.
Now forward the arguments as-is without having to quote the whole argument list. This allows for filenames with spaces, especially useful for testing parsing of list files.
1 parent 6dd6f08 commit 8615527

7 files changed

Lines changed: 192 additions & 94 deletions

File tree

tool/CMakeLists.txt

Lines changed: 172 additions & 85 deletions
Large diffs are not rendered by default.

tool/test/array.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
array0.png
2-
array1.png
3-
array2.png
1+
array 0.png
2+
array 1.png
3+
array 2.png

tool/test/run-test.bat

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,20 @@
11
@ECHO OFF
22
set command=%1
33
set command=%command:/=\%
4-
set args=%~2
5-
set exitCode=%3
4+
shift
5+
set exitCode=%1
6+
shift
67

7-
"%command%" %args%
8+
REM see https://stackoverflow.com/questions/34004969/using-after-shift
9+
set args=
10+
:buildArgs
11+
if @%1==@ goto done
12+
set "args=%args% %1"
13+
shift
14+
goto buildArgs
15+
:done
16+
17+
"%command%" %*
818
set realExitCode=%ERRORLEVEL%
919
if %exitCode% NEQ %realExitCode% (
1020
echo got exit code %realExitCode%; expected %exitCode%

tool/test/run-test.sh

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
#!/bin/sh
22

33
command=$1
4-
args=$2
5-
exitCode=$3
4+
shift
5+
exitCode=$1
6+
shift
67

7-
"$command" $args
8+
"$command" "$@"
89
realExitCode=$?
910
if [ $exitCode != $realExitCode ]; then
1011
echo "got exit code $realExitCode; expected $exitCode"

0 commit comments

Comments
 (0)