[PATCH 1/5] kernel32/tests: Correctly check for failure from FindFirstFile().
Zebediah Figura
z.figura12 at gmail.com
Tue Feb 2 18:17:11 CST 2021
From: Zebediah Figura <zfigura at codeweavers.com>
Signed-off-by: Zebediah Figura <z.figura12 at gmail.com>
---
dlls/kernel32/tests/file.c | 35 +++++++++++++++++++----------------
1 file changed, 19 insertions(+), 16 deletions(-)
diff --git a/dlls/kernel32/tests/file.c b/dlls/kernel32/tests/file.c
index 2814ab194b2..6d2a216e39c 100644
--- a/dlls/kernel32/tests/file.c
+++ b/dlls/kernel32/tests/file.c
@@ -2928,7 +2928,7 @@ static void test_FindFirstFile_wildcards(void)
{0, "*.. ", ", '.', '..', '..a', '..a.a', '.a', '.a..a', '.a.a', '.aaa', 'a', 'a..a', 'a.a', 'a.a.a', 'aa', 'aaa', 'aaaa'"},
{1, "*. .", ", '.', '..', 'a', '.a', '..a', 'aa', 'aaa', 'aaaa', '.aaa'"},
{1, "* ..", ", '.', '..', 'a', '.a', '..a', 'aa', 'aaa', 'aaaa', '.aaa'"},
- {1, " *..", ", '.aaa'"},
+ {0, " *..", ""},
{0, "..* ", ", '.', '..', '..a', '..a.a'"},
{1, "?", ", '.', '..', 'a'"},
{1, "?.", ", '.', '..', 'a'"},
@@ -2954,23 +2954,26 @@ static void test_FindFirstFile_wildcards(void)
correct[0] = incorrect[0] = 0;
handle = FindFirstFileA(tests[i].pattern, &find_data);
- if (handle) do {
- char* ptr;
- char quoted[16];
+ if (handle != INVALID_HANDLE_VALUE)
+ {
+ do {
+ char *ptr;
+ char quoted[16];
- sprintf( quoted, ", '%.10s'", find_data.cFileName );
+ sprintf(quoted, ", '%.10s'", find_data.cFileName);
- if ((ptr = strstr(missing, quoted)))
- {
- int len = strlen(quoted);
- while ((ptr[0] = ptr[len]) != 0)
- ++ptr;
- strcat(correct, quoted);
- }
- else
- strcat(incorrect, quoted);
- } while (FindNextFileA(handle, &find_data));
- FindClose(handle);
+ if ((ptr = strstr(missing, quoted)))
+ {
+ int len = strlen(quoted);
+ while ((ptr[0] = ptr[len]) != 0)
+ ++ptr;
+ strcat(correct, quoted);
+ }
+ else
+ strcat(incorrect, quoted);
+ } while (FindNextFileA(handle, &find_data));
+ FindClose(handle);
+ }
todo_wine_if (tests[i].todo)
ok(missing[0] == 0 && incorrect[0] == 0,
--
2.20.1
More information about the wine-devel
mailing list