Module: wine Branch: refs/heads/master Commit: 99fa40e2bf84e773ca39a7055f0d79bfe6718ad2 URL: http://source.winehq.org/git/?p=wine.git;a=commit;h=99fa40e2bf84e773ca39a705...
Author: Karsten Elfenbein kelfe@gmx.de Date: Mon Jun 5 16:23:21 2006 +0200
kernel/tests: More tests for FindFirstFile.
---
dlls/kernel/tests/file.c | 60 ++++++++++++++++++++++++++++++++++++++++------ 1 files changed, 52 insertions(+), 8 deletions(-)
diff --git a/dlls/kernel/tests/file.c b/dlls/kernel/tests/file.c index 758cb72..ec736db 100644 --- a/dlls/kernel/tests/file.c +++ b/dlls/kernel/tests/file.c @@ -1192,20 +1192,64 @@ static void test_FindFirstFileA(void) WIN32_FIND_DATAA search_results; int err; char buffer[5] = "C:\"; + char buffer2[100];
/* try FindFirstFileA on "C:" */ buffer[0] = get_windows_drive(); - handle = FindFirstFileA(buffer,&search_results); + + SetLastError( 0xdeadbeaf ); + handle = FindFirstFileA(buffer, &search_results); err = GetLastError(); - ok ( handle == INVALID_HANDLE_VALUE , "FindFirstFile on root directory should Fail\n"); - if (handle == INVALID_HANDLE_VALUE) - ok ( err == ERROR_FILE_NOT_FOUND, "Bad Error number %d\n", err); + ok ( handle == INVALID_HANDLE_VALUE, "FindFirstFile on root directory should fail\n" ); + ok ( err == ERROR_FILE_NOT_FOUND, "Bad Error number %d\n", err );
/* try FindFirstFileA on "C:*" */ - strcat(buffer, "*"); - handle = FindFirstFileA(buffer,&search_results); - ok ( handle != INVALID_HANDLE_VALUE, "FindFirstFile on %s should succeed\n", buffer ); - ok ( FindClose(handle) == TRUE, "Failed to close handle\n"); + strcpy(buffer2, buffer); + strcat(buffer2, "*"); + handle = FindFirstFileA(buffer2, &search_results); + ok ( handle != INVALID_HANDLE_VALUE, "FindFirstFile on %s should succeed\n", buffer2 ); + ok ( FindClose(handle) == TRUE, "Failed to close handle %s\n", buffer2 ); + + /* try FindFirstFileA on "C:\foo" */ + SetLastError( 0xdeadbeaf ); + strcpy(buffer2, buffer); + strcat(buffer2, "foo\"); + handle = FindFirstFileA(buffer2, &search_results); + err = GetLastError(); + ok ( handle == INVALID_HANDLE_VALUE, "FindFirstFile on %s should Fail\n", buffer2 ); + ok ( err == ERROR_FILE_NOT_FOUND, "Bad Error number %d\n", err ); + + /* try FindFirstFileA on "C:\foo\bar.txt" */ + SetLastError( 0xdeadbeaf ); + strcpy(buffer2, buffer); + strcat(buffer2, "foo\bar.txt"); + handle = FindFirstFileA(buffer2, &search_results); + err = GetLastError(); + ok ( handle == INVALID_HANDLE_VALUE, "FindFirstFile on %s should Fail\n", buffer2 ); + todo_wine { + ok ( err == ERROR_PATH_NOT_FOUND, "Bad Error number %d\n", err ); + } + + /* try FindFirstFileA on "C:\foo*.*" */ + SetLastError( 0xdeadbeaf ); + strcpy(buffer2, buffer); + strcat(buffer2, "foo\*.*"); + handle = FindFirstFileA(buffer2, &search_results); + err = GetLastError(); + ok ( handle == INVALID_HANDLE_VALUE, "FindFirstFile on %s should Fail\n", buffer2 ); + todo_wine { + ok ( err == ERROR_PATH_NOT_FOUND, "Bad Error number %d\n", err ); + } + + /* try FindFirstFileA on "foo\bar.txt" */ + SetLastError( 0xdeadbeaf ); + strcpy(buffer2, "foo\bar.txt"); + handle = FindFirstFileA(buffer2, &search_results); + err = GetLastError(); + ok ( handle == INVALID_HANDLE_VALUE, "FindFirstFile on %s should Fail\n", buffer2 ); + todo_wine { + ok ( err == ERROR_PATH_NOT_FOUND, "Bad Error number %d\n", err ); + } }
static void test_FindNextFileA(void)