From: Eric Pouech epouech@codeweavers.com
And get rid of some hacks.
Signed-off-by: Eric Pouech epouech@codeweavers.com --- programs/cmd/tests/batch.c | 22 ---------------------- programs/cmd/tests/test_builtins.cmd | 9 ++++++--- 2 files changed, 6 insertions(+), 25 deletions(-)
diff --git a/programs/cmd/tests/batch.c b/programs/cmd/tests/batch.c index 03a05f34215..5c5b0ab7287 100644 --- a/programs/cmd/tests/batch.c +++ b/programs/cmd/tests/batch.c @@ -513,24 +513,6 @@ static int cmd_available(void) return FALSE; }
-void create_nul_test_file(void) -{ - HANDLE file; - DWORD size; - BOOL bres; - char contents[] = "a b c\nd e\0f\ng h i"; - - file = CreateFileA("nul_test_file", GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, - FILE_ATTRIBUTE_NORMAL, NULL); - ok(file != INVALID_HANDLE_VALUE, "CreateFile failed\n"); - if(file == INVALID_HANDLE_VALUE) - return; - - bres = WriteFile(file, contents, ARRAYSIZE(contents), &size, NULL); - ok(bres, "Could not write to file: %lu\n", GetLastError()); - CloseHandle(file); -} - START_TEST(batch) { int argc; @@ -555,13 +537,9 @@ START_TEST(batch) } shortpath_len = GetShortPathNameA(path, shortpath, ARRAY_SIZE(shortpath));
- create_nul_test_file(); - argc = winetest_get_mainargs(&argv); if(argc > 2) run_from_file(argv[2]); else EnumResourceNamesA(NULL, "TESTCMD", test_enum_proc, 0); - - DeleteFileA("nul_test_file"); } diff --git a/programs/cmd/tests/test_builtins.cmd b/programs/cmd/tests/test_builtins.cmd index 9f144bb4e0a..b66beadca98 100644 --- a/programs/cmd/tests/test_builtins.cmd +++ b/programs/cmd/tests/test_builtins.cmd @@ -2641,9 +2641,12 @@ FOR /F "delims=. tokens=1*" %%A IN (testfile) DO @echo 5:%%A,%%B FOR /F "delims=. tokens=2*" %%A IN (testfile) DO @echo 6:%%A,%%B FOR /F "delims=. tokens=3*" %%A IN (testfile) DO @echo 7:%%A,%%B del testfile -rem file contains NUL, created by the .exe -for /f %%A in (nul_test_file) DO echo %%A -for /f "tokens=*" %%A in (nul_test_file) DO echo %%A +rem generate "a b c\nd e\0f\ng h i" +echo 61206220630a64206500660a6720682069> a.seq +call certutil.exe -decodehex a.seq testfile > NUL +for /f %%A in (testfile) DO echo %%A +for /f "tokens=*" %%A in (testfile) DO echo %%A +del a.seq testfile
echo ------------ Testing del ------------ echo abc > file