Commit 83933c59 authored by Fabian Maurer's avatar Fabian Maurer Committed by Alexandre Julliard

find.exe/tests: Add test for multiple files at once.

parent 53b305c3
...@@ -264,6 +264,56 @@ static void run_find_unicode_(const BYTE *input, int input_len, const BYTE *out_ ...@@ -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); 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) static void test_errors(void)
{ {
run_find_stdin_str("", "", "FIND: Parameter format not correct\r\n", 2); run_find_stdin_str("", "", "FIND: Parameter format not correct\r\n", 2);
...@@ -411,6 +461,7 @@ START_TEST(find) ...@@ -411,6 +461,7 @@ START_TEST(find)
else else
{ {
test_errors(); test_errors();
run_find_file_multi();
} }
test_singleline_without_switches(); test_singleline_without_switches();
test_multiline(); test_multiline();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment