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:
Frédéric Delanoy 2011-07-28 01:06:45 +02:00 committed by Alexandre Julliard
parent 81bf925401
commit 5fe0f1e1dc
3 changed files with 19 additions and 11 deletions

View file

@ -200,7 +200,12 @@ static const char *compare_line(const char *out_line, const char *out_end, const
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)
@ -227,6 +232,9 @@ static void test_output(const char *out_data, DWORD out_size, const char *exp_da
if(err == out_nl)
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);
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
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);

View file

@ -18,13 +18,13 @@ at-echoed-word
@pwd@>echo "/?"@space@
"/?"
@pwd@>echo.
@todo_wine@@pwd@>echo.
@pwd@>echo .@space@
.
@pwd@>echo.word
@todo_wine@@pwd@>echo.word
word
@pwd@>echo .word@space@
@ -100,7 +100,7 @@ FOOBAR = baz
bar
@todo_wine@FOOBAR= bar
@todo_wine@FOOBAR = baz2
FOOBAR = baz
FOOBAR = baz2
FOOBAR not defined
1
bar
@ -114,7 +114,7 @@ bar
~dp0 should be directory containing batch file
@pwd@\
@pwd@\
CD value @pwd@@or_broken@CD value
CD value @pwd@@or_broken@CD value@space@
%
P
P
@ -236,8 +236,8 @@ bar removed
foobar removed
bar\baz removed
------------ Testing CALL --------------
foo
foo 8
foo@space@
@todo_wine@foo 8
bar :testRoutine
@todo_wine@0
@todo_wine@foo created