Alexandre Julliard : kernel32/tests: Added test case for . and .. directory entries.

Alexandre Julliard julliard at wine.codeweavers.com
Fri Dec 1 06:29:34 CST 2006


Module: wine
Branch: master
Commit: 7cd9400b806e4505bc109f1003b3f5c99d766393
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=7cd9400b806e4505bc109f1003b3f5c99d766393

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Fri Dec  1 13:11:53 2006 +0100

kernel32/tests: Added test case for . and .. directory entries.

---

 dlls/kernel32/tests/file.c |   18 ++++++++++++++++++
 1 files changed, 18 insertions(+), 0 deletions(-)

diff --git a/dlls/kernel32/tests/file.c b/dlls/kernel32/tests/file.c
index d9677fc..5b86d3c 100644
--- a/dlls/kernel32/tests/file.c
+++ b/dlls/kernel32/tests/file.c
@@ -1205,6 +1205,24 @@ static void test_FindFirstFileA(void)
     strcat(buffer2, "*");
     handle = FindFirstFileA(buffer2, &data);
     ok ( handle != INVALID_HANDLE_VALUE, "FindFirstFile on %s should succeed\n", buffer2 );
+    ok ( strcmp( data.cFileName, "." ) && strcmp( data.cFileName, ".." ),
+         "FindFirstFile shouldn't return '%s' in drive root\n", data.cFileName );
+    if (FindNextFileA( handle, &data ))
+        ok ( strcmp( data.cFileName, "." ) && strcmp( data.cFileName, ".." ),
+             "FindNextFile shouldn't return '%s' in drive root\n", data.cFileName );
+    ok ( FindClose(handle) == TRUE, "Failed to close handle %s\n", buffer2 );
+
+    /* try FindFirstFileA on windows dir */
+    GetWindowsDirectory( buffer2, sizeof(buffer2) );
+    strcat(buffer2, "\\*");
+    handle = FindFirstFileA(buffer2, &data);
+    ok( handle != INVALID_HANDLE_VALUE, "FindFirstFile on %s should succeed\n", buffer2 );
+    ok( !strcmp( data.cFileName, "." ), "FindFirstFile should return '.' first\n" );
+    ok( FindNextFileA( handle, &data ), "FindNextFile failed\n" );
+    ok( !strcmp( data.cFileName, ".." ), "FindNextFile should return '..' as second entry\n" );
+    while (FindNextFileA( handle, &data ))
+        ok ( strcmp( data.cFileName, "." ) && strcmp( data.cFileName, ".." ),
+             "FindNextFile shouldn't return '%s'\n", data.cFileName );
     ok ( FindClose(handle) == TRUE, "Failed to close handle %s\n", buffer2 );
 
     /* try FindFirstFileA on "C:\foo\" */




More information about the wine-cvs mailing list