static void test_output(const char *out_data, DWORD out_size, const char *exp_data, DWORD exp_size)
{
- const char *out_ptr = out_data, *exp_ptr = exp_data, *out_nl, *exp_nl, *err;
+ const char *out_ptr = out_data, *exp_ptr = exp_data, *out_nl, *exp_nl, *err = NULL;
DWORD line = 0;
static const char todo_wine_cmd[] = {'@','t','o','d','o','_','w','i','n','e','@'};
static const char resync_cmd[] = {'-','-','-'};
- BOOL is_todo_wine, is_out_resync, is_exp_resync;
+ BOOL is_todo_wine, is_out_resync = FALSE, is_exp_resync = FALSE;
while(out_ptr < out_data+out_size && exp_ptr < exp_data+exp_size) {
line++;
is_todo_wine = (exp_ptr+sizeof(todo_wine_cmd) <= exp_nl &&
!memcmp(exp_ptr, todo_wine_cmd, sizeof(todo_wine_cmd)));
- if (is_todo_wine) {
+ if (is_todo_wine)
exp_ptr += sizeof(todo_wine_cmd);
- winetest_start_todo("wine");
- }
- is_exp_resync=(exp_ptr+sizeof(resync_cmd) <= exp_nl &&
- !memcmp(exp_ptr, resync_cmd, sizeof(resync_cmd)));
- is_out_resync=(out_ptr+sizeof(resync_cmd) <= out_nl &&
- !memcmp(out_ptr, resync_cmd, sizeof(resync_cmd)));
-
- err = compare_line(out_ptr, out_nl, exp_ptr, exp_nl);
- 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 if (!err && is_todo_wine && is_out_resync && is_exp_resync)
- /* Consider that the todo_wine was to deal with extra lines,
- * not for the resync line itself
- */
- err = NULL;
- 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);
- if(is_todo_wine) winetest_end_todo("wine");
+ todo_wine_if(is_todo_wine)
+ {
+ is_exp_resync=(exp_ptr+sizeof(resync_cmd) <= exp_nl &&
+ !memcmp(exp_ptr, resync_cmd, sizeof(resync_cmd)));
+ is_out_resync=(out_ptr+sizeof(resync_cmd) <= out_nl &&
+ !memcmp(out_ptr, resync_cmd, sizeof(resync_cmd)));
+
+ err = compare_line(out_ptr, out_nl, exp_ptr, exp_nl);
+ 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 if (!err && is_todo_wine && is_out_resync && is_exp_resync)
+ /* Consider that the todo_wine was to deal with extra lines,
+ * not for the resync line itself
+ */
+ err = NULL;
+ 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);
+ }
if (is_exp_resync && err && is_todo_wine)
{
/* If we rewind to the beginning of the line, don't increment line number */
line--;
}
- else if (!is_exp_resync || !err)
+ else if (!is_exp_resync || !err ||
+ (is_exp_resync && is_out_resync && err))
{
exp_ptr = exp_nl+1;
if(exp_nl+1 < exp_data+exp_size && exp_nl[0] == '\r' && exp_nl[1] == '\n')
del temp.bat 2>nul
call :WriteLine set WINE_found=N
for /l %%i in (1,1,%WINE_expectedresults%) do (
- call :WriteLine if "%%%%WINE_expectedresults.%%i%%%%"=="%%%%1" set WINE_found=Y
+ call :WriteLine if "%%%%WINE_expectedresults.%%i%%%%"=="%%%%~1" set WINE_found=Y
call :WriteLine if "%%%%WINE_found%%%%"=="Y" set WINE_expectedresults.%%i=
call :WriteLine if "%%%%WINE_found%%%%"=="Y" goto :eof
)
-call :WriteLine echo Got unexpected result: "%%%%1"
+call :WriteLine echo Got unexpected result: "%%%%~1"
goto :eof
:WriteLine
goto :eof
:TestForR
-rem %CD% does not tork on NT4 so use the following workaround
+rem %CD% does not work on NT4 so use the following workaround
for /d %%i in (.) do set WINE_CURDIR=%%~dpnxi
echo --- for /R
set WINE_expectedresults.3=%WINE_CURDIR%\baz\.
set WINE_expectedresults.4=%WINE_CURDIR%\foo\.
call :SetExpected
-for /R %%i in (.) do call temp.bat %%i
+for /R %%i in (.) do call temp.bat "%%i"
call :ValidateExpected
echo Plain directory enumeration from provided root
set WINE_expectedresults.4=%WINE_CURDIR%\foo\.
if "%CD%"=="" goto :SkipBrokenNT4
call :SetExpected
-for /R "%WINE_CURDIR%" %%i in (.) do call temp.bat %%i
+for /R "%WINE_CURDIR%" %%i in (.) do call temp.bat "%%i"
call :ValidateExpected
:SkipBrokenNT4
set WINE_expectedresults.1=%WINE_CURDIR%\baz\bazbaz
set WINE_expectedresults.2=%WINE_CURDIR%\bazbaz
call :SetExpected
-for /R %%i in (baz*) do call temp.bat %%i
+for /R %%i in (baz*) do call temp.bat "%%i"
call :ValidateExpected
echo File enumeration from provided root
set WINE_expectedresults.1=%WINE_CURDIR%\baz\bazbaz
set WINE_expectedresults.2=%WINE_CURDIR%\bazbaz
call :SetExpected
-for /R %%i in (baz*) do call temp.bat %%i
+for /R %%i in (baz*) do call temp.bat "%%i"
call :ValidateExpected
echo Mixed enumeration
set WINE_expectedresults.5=%WINE_CURDIR%\bazbaz
set WINE_expectedresults.6=%WINE_CURDIR%\foo\.
call :SetExpected
-for /R %%i in (. baz*) do call temp.bat %%i
+for /R %%i in (. baz*) do call temp.bat "%%i"
call :ValidateExpected
echo Mixed enumeration from provided root
set WINE_expectedresults.5=%WINE_CURDIR%\bazbaz
set WINE_expectedresults.6=%WINE_CURDIR%\foo\.
call :SetExpected
-for /R %%i in (. baz*) do call temp.bat %%i
+for /R %%i in (. baz*) do call temp.bat "%%i"
call :ValidateExpected
echo With duplicates enumeration
set WINE_expectedresults.11=%WINE_CURDIR%\foo\fred
set WINE_expectedresults.12=%WINE_CURDIR%\fred
call :SetExpected
-for /R %%i in (baz* bazbaz fred ba*) do call temp.bat %%i
+for /R %%i in (baz* bazbaz fred ba*) do call temp.bat "%%i"
call :ValidateExpected
echo Strip missing wildcards, keep unwildcarded names
set WINE_expectedresults.5=%WINE_CURDIR%\foo\jim
set WINE_expectedresults.6=%WINE_CURDIR%\jim
call :SetExpected
-for /R %%i in (baz* fred* jim) do call temp.bat %%i
+for /R %%i in (baz* fred* jim) do call temp.bat "%%i"
call :ValidateExpected
echo for /R passed
cd ..
rd /s/q foobar
+echo ------------ Testing del ------------
+echo abc > file
+echo deleting 'file'
+del file
+if errorlevel 0 (
+ echo errorlevel is 0, good
+) else (
+ echo unexpected errorlevel, got %errorlevel%
+)
+if not exist file (
+ echo successfully deleted 'file'
+) else (
+ echo error deleting 'file'
+)
+echo attempting to delete 'file', even though it is not present
+del file
+if errorlevel 0 (
+ echo errorlevel is 0, good
+) else (
+ echo unexpected errorlevel, got %errorlevel%
+)
+
echo ------------ Testing del /a ------------
del /f/q *.test > nul
echo r > r.test
cd .. & rd /s/q foobar
echo ------------ Testing assoc ------------
+rem Modifying associations requires some privileges...
+net session >nul 2>&1
+if errorlevel 1 goto :SkipAssoc
+
rem FIXME Can't test error messages in the current test system, so we have to use some kludges
rem FIXME Revise once || conditional execution is fixed
mkdir foobar & cd foobar
type baz
echo ---
cd .. & rd /s/q foobar
+goto ContinueFType
+:SkipAssoc
+echo --- setting association
+echo ---
+echo .foo=bar
+echo .foo=bar
+echo +++
+echo .foo=bar
+echo --- resetting association
+echo ---
+echo +++
+echo ---
+
+:ContinueFType
echo ------------ Testing ftype ------------
+rem Modifying associations requires some privileges...
+net session >nul 2>&1
+if errorlevel 1 goto :SkipFType
rem FIXME Can't test error messages in the current test system, so we have to use some kludges
rem FIXME Revise once || conditional execution is fixed
mkdir foobar & cd foobar
set WINE_FOO=
endlocal
cd .. & rd /s/q foobar
+goto ContinueCall
+:SkipFType
+echo --- setting association
+echo ---
+echo footype=foo_opencmd
+echo .foo=footype
+echo footype=foo_opencmd
+echo +++
+echo footype=foo_opencmd
+echo --- resetting association
+echo original value
+:ContinueCall
echo ------------ Testing CALL ------------
mkdir foobar & cd foobar
echo --- external script
rem FIXME: creating file before setting envvar value to prevent parsing-time evaluation (due to EnableDelayedExpansion not being implemented/available yet)
echo --- setlocal with corresponding endlocal
-rem %CD% does not tork on NT4 so use the following workaround
+rem %CD% does not work on NT4 so use the following workaround
for /d %%i in (.) do set WINE_CURDIR=%%~dpnxi
echo @echo off> test.cmd
echo echo %%WINE_VAR%%>> test.cmd
echo echo %%WINE_VAR%%>> test.cmd
echo for /d %%%%i in (.) do echo %%%%~dpnxi>> test.cmd
set WINE_VAR=globalval
-rem %CD% does not tork on NT4 so use the following workaround
+rem %CD% does not work on NT4 so use the following workaround
for /d %%i in (.) do set WINE_CURDIR=%%~dpnxi
call test.cmd
echo %WINE_VAR%
set WINE_var1=one
set WINE_var2=
set WINE_var3=
-rem %CD% does not tork on NT4 so use the following workaround
+rem %CD% does not work on NT4 so use the following workaround
for /d %%i in (.) do set WINE_CURDIR=%%~dpnxi
setlocal
set WINE_var2=two
mkdir foodir2 2>nul
mkdir foodir3 2>nul
mkdir foodir4 2>nul
-rem %CD% does not tork on NT4 so use the following workaround
+rem %CD% does not work on NT4 so use the following workaround
for /d %%i in (.) do set WINE_curdir=%%~dpnxi
echo @echo off> 2set1end.cmd
setlocal
set WINE_var=value2
cd foodir2
-call %WINE_CURDIR%\2set1end.cmd
+call "%WINE_CURDIR%\2set1end.cmd"
echo Finished:
echo %WINE_VAR%
for /d %%i in (.) do echo %%~dpnxi
setlocal
set WINE_var=value2
cd foodir2
-call %WINE_CURDIR%\1set2end.cmd
+call "%WINE_CURDIR%\1set2end.cmd"
echo Finished:
echo %WINE_VAR%
for /d %%i in (.) do echo %%~dpnxi