cmd/tests: Fix test runner so it catches cases where an output line contains the associated expected line as prefix.
This commit is contained in:
parent
81bf925401
commit
5fe0f1e1dc
|
@ -200,7 +200,12 @@ static const char *compare_line(const char *out_line, const char *out_end, const
|
||||||
out_ptr++;
|
out_ptr++;
|
||||||
}
|
}
|
||||||
|
|
||||||
return exp_ptr == exp_end ? NULL : out_ptr;
|
if(exp_ptr != exp_end)
|
||||||
|
return out_ptr;
|
||||||
|
else if(out_ptr != out_end)
|
||||||
|
return exp_end;
|
||||||
|
|
||||||
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void test_output(const char *out_data, DWORD out_size, const char *exp_data, DWORD exp_size)
|
static void test_output(const char *out_data, DWORD out_size, const char *exp_data, DWORD exp_size)
|
||||||
|
@ -227,6 +232,9 @@ static void test_output(const char *out_data, DWORD out_size, const char *exp_da
|
||||||
if(err == out_nl)
|
if(err == out_nl)
|
||||||
ok(0, "unexpected end of line %d (got '%.*s', wanted '%.*s')\n",
|
ok(0, "unexpected end of line %d (got '%.*s', wanted '%.*s')\n",
|
||||||
line, (int)(out_nl-out_ptr), out_ptr, (int)(exp_nl-exp_ptr), exp_ptr);
|
line, (int)(out_nl-out_ptr), out_ptr, (int)(exp_nl-exp_ptr), exp_ptr);
|
||||||
|
else if(err == exp_nl)
|
||||||
|
ok(0, "excess characters on line %d (got '%.*s', wanted '%.*s')\n",
|
||||||
|
line, (int)(out_nl-out_ptr), out_ptr, (int)(exp_nl-exp_ptr), exp_ptr);
|
||||||
else
|
else
|
||||||
ok(!err, "unexpected char 0x%x position %d in line %d (got '%.*s', wanted '%.*s')\n",
|
ok(!err, "unexpected char 0x%x position %d in line %d (got '%.*s', wanted '%.*s')\n",
|
||||||
(err ? *err : 0), (err ? (int)(err-out_ptr) : -1), line, (int)(out_nl-out_ptr), out_ptr, (int)(exp_nl-exp_ptr), exp_ptr);
|
(err ? *err : 0), (err ? (int)(err-out_ptr) : -1), line, (int)(out_nl-out_ptr), out_ptr, (int)(exp_nl-exp_ptr), exp_ptr);
|
||||||
|
|
|
@ -263,10 +263,10 @@ goto :eof
|
||||||
:endForTestFun1
|
:endForTestFun1
|
||||||
for %%i in (X) do (
|
for %%i in (X) do (
|
||||||
for %%j in (Y) do (
|
for %%j in (Y) do (
|
||||||
echo %%i %%j ))
|
echo %%i %%j))
|
||||||
for %%i in (A B) do (
|
for %%i in (A B) do (
|
||||||
for %%j in (C D) do (
|
for %%j in (C D) do (
|
||||||
echo %%i %%j ))
|
echo %%i %%j))
|
||||||
for %%i in (A B) do (
|
for %%i in (A B) do (
|
||||||
for %%j in (C D) do (
|
for %%j in (C D) do (
|
||||||
call :forTestFun2 %%i %%j ))
|
call :forTestFun2 %%i %%j ))
|
||||||
|
@ -478,7 +478,7 @@ rd /s/q foobaz
|
||||||
echo ------------ Testing CALL --------------
|
echo ------------ Testing CALL --------------
|
||||||
mkdir foobar & cd foobar
|
mkdir foobar & cd foobar
|
||||||
rem External script
|
rem External script
|
||||||
echo echo foo %%1 > foo.cmd
|
echo echo foo %%1> foo.cmd
|
||||||
call foo
|
call foo
|
||||||
call foo.cmd 8
|
call foo.cmd 8
|
||||||
del foo.cmd
|
del foo.cmd
|
||||||
|
@ -510,7 +510,7 @@ call :setError 0
|
||||||
call for %%i in (foo bar baz) do echo %%i 2> nul
|
call for %%i in (foo bar baz) do echo %%i 2> nul
|
||||||
echo %ErrorLevel%
|
echo %ErrorLevel%
|
||||||
rem First look for programs in the path before trying a builtin
|
rem First look for programs in the path before trying a builtin
|
||||||
echo echo non-builtin dir > dir.cmd
|
echo echo non-builtin dir> dir.cmd
|
||||||
call dir /b
|
call dir /b
|
||||||
cd ..
|
cd ..
|
||||||
rd /s/q foobar
|
rd /s/q foobar
|
||||||
|
|
|
@ -18,13 +18,13 @@ at-echoed-word
|
||||||
@pwd@>echo "/?"@space@
|
@pwd@>echo "/?"@space@
|
||||||
"/?"
|
"/?"
|
||||||
|
|
||||||
@pwd@>echo.
|
@todo_wine@@pwd@>echo.
|
||||||
|
|
||||||
|
|
||||||
@pwd@>echo .@space@
|
@pwd@>echo .@space@
|
||||||
.
|
.
|
||||||
|
|
||||||
@pwd@>echo.word
|
@todo_wine@@pwd@>echo.word
|
||||||
word
|
word
|
||||||
|
|
||||||
@pwd@>echo .word@space@
|
@pwd@>echo .word@space@
|
||||||
|
@ -100,7 +100,7 @@ FOOBAR = baz
|
||||||
bar
|
bar
|
||||||
@todo_wine@FOOBAR= bar
|
@todo_wine@FOOBAR= bar
|
||||||
@todo_wine@FOOBAR = baz2
|
@todo_wine@FOOBAR = baz2
|
||||||
FOOBAR = baz
|
FOOBAR = baz2
|
||||||
FOOBAR not defined
|
FOOBAR not defined
|
||||||
1
|
1
|
||||||
bar
|
bar
|
||||||
|
@ -114,7 +114,7 @@ bar
|
||||||
~dp0 should be directory containing batch file
|
~dp0 should be directory containing batch file
|
||||||
@pwd@\
|
@pwd@\
|
||||||
@pwd@\
|
@pwd@\
|
||||||
CD value @pwd@@or_broken@CD value
|
CD value @pwd@@or_broken@CD value@space@
|
||||||
%
|
%
|
||||||
P
|
P
|
||||||
P
|
P
|
||||||
|
@ -236,8 +236,8 @@ bar removed
|
||||||
foobar removed
|
foobar removed
|
||||||
bar\baz removed
|
bar\baz removed
|
||||||
------------ Testing CALL --------------
|
------------ Testing CALL --------------
|
||||||
foo
|
foo@space@
|
||||||
foo 8
|
@todo_wine@foo 8
|
||||||
bar :testRoutine
|
bar :testRoutine
|
||||||
@todo_wine@0
|
@todo_wine@0
|
||||||
@todo_wine@foo created
|
@todo_wine@foo created
|
||||||
|
|
Loading…
Reference in New Issue