find.exe/tests: Add test for multiple files at once.
Signed-off-by: Fabian Maurer <dark.shadow4@web.de> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
53b305c35e
commit
83933c596f
|
@ -264,6 +264,56 @@ static void run_find_unicode_(const BYTE *input, int input_len, const BYTE *out_
|
|||
run_find_stdin_(wstr_quoted_test, input, input_len, out_expected_mangled, out_expected_mangled_len, exitcode_expected, file, line);
|
||||
}
|
||||
|
||||
static void run_find_file_multi(void)
|
||||
{
|
||||
char path_temp_file1[MAX_PATH];
|
||||
char path_temp_file2[MAX_PATH];
|
||||
char path_temp_file3[MAX_PATH];
|
||||
char path_temp_dir[MAX_PATH];
|
||||
HANDLE handle_file;
|
||||
WCHAR commandline_new[MAX_PATH];
|
||||
char out_expected[500];
|
||||
const char* input = "ab\nbd";
|
||||
|
||||
GetTempPathA(ARRAY_SIZE(path_temp_dir), path_temp_dir);
|
||||
GetTempFileNameA(path_temp_dir, "", 0, path_temp_file1);
|
||||
GetTempFileNameA(path_temp_dir, "", 0, path_temp_file2);
|
||||
GetTempFileNameA(path_temp_dir, "", 0, path_temp_file3);
|
||||
handle_file = CreateFileA(path_temp_file1, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, 0, NULL);
|
||||
write_to_handle(handle_file, (BYTE*)input, strlen(input));
|
||||
CloseHandle(handle_file);
|
||||
handle_file = CreateFileA(path_temp_file2, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, 0, NULL);
|
||||
write_to_handle(handle_file, (BYTE*)input, strlen(input));
|
||||
CloseHandle(handle_file);
|
||||
|
||||
wsprintfW(commandline_new, L"\"b\" C:\\doesnotexist1 %hs C:\\doesnotexist1 %hs C:\\doesnotexist1 %hs", path_temp_file1, path_temp_file2, path_temp_file3);
|
||||
|
||||
/* Keep file open during the test */
|
||||
handle_file = CreateFileA(path_temp_file3, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, 0, NULL);
|
||||
|
||||
CharUpperA(path_temp_file1);
|
||||
CharUpperA(path_temp_file2);
|
||||
CharUpperA(path_temp_file3);
|
||||
wsprintfA(out_expected,
|
||||
"File not found - C:\\DOESNOTEXIST1\r\n"
|
||||
"\r\n---------- %s\r\n"
|
||||
"ab\r\nbd\r\n"
|
||||
"File not found - C:\\DOESNOTEXIST1\r\n"
|
||||
"\r\n---------- %s\r\n"
|
||||
"ab\r\nbd\r\n"
|
||||
"File not found - C:\\DOESNOTEXIST1\r\n"
|
||||
"File not found - %s\r\n",
|
||||
path_temp_file1, path_temp_file2, path_temp_file3);
|
||||
|
||||
todo_wine
|
||||
run_find_stdin_(commandline_new, (BYTE*)"", 0, (BYTE*)out_expected, strlen(out_expected), 0, __FILE__, __LINE__);
|
||||
|
||||
CloseHandle(handle_file);
|
||||
DeleteFileA(path_temp_file1);
|
||||
DeleteFileA(path_temp_file2);
|
||||
DeleteFileA(path_temp_file3);
|
||||
}
|
||||
|
||||
static void test_errors(void)
|
||||
{
|
||||
run_find_stdin_str("", "", "FIND: Parameter format not correct\r\n", 2);
|
||||
|
@ -411,6 +461,7 @@ START_TEST(find)
|
|||
else
|
||||
{
|
||||
test_errors();
|
||||
run_find_file_multi();
|
||||
}
|
||||
test_singleline_without_switches();
|
||||
test_multiline();
|
||||
|
|
Loading…
Reference in New Issue