New _lcreat tests (patch included)

Ferenc Wagner wferi at tba.elte.hu
Sat May 17 16:10:07 CDT 2003


Andreas Mohr <andi at rhlx01.fht-esslingen.de> wrote:

> I'd rather say that this is a test of whether or not you
> manage to include the patch ;)

and I really wondered what that may mean, until I read that

Mike Hearn <mike at theoretic.com> wrote:

> it seems you forget the attachment?

when I slapped my head.  I even checked that my post got
into the archives.  So thank you, and let me try again...

                                              Feri.


These are to reveal the difference to the DOS interface
(interrupt 21 sevice 3c), which does not pass a similar
test.  If anybody knows how to include a test for that (I
have got a 16 bit DOS program for now), let me know.

Changelog:
  New _lcreat test for filename ending in a slash.
  New _lcreat test for volume label attribute.

Index: dlls/kernel/tests/file.c
===================================================================
RCS file: /home/wine/wine/dlls/kernel/tests/file.c,v
retrieving revision 1.16
diff -u -r1.16 file.c
--- dlls/kernel/tests/file.c	17 Apr 2003 02:10:04 -0000	1.16
+++ dlls/kernel/tests/file.c	17 May 2003 16:17:57 -0000
@@ -193,6 +193,8 @@
     HFILE filehandle;
     char buffer[10000];
     WIN32_FIND_DATAA search_results;
+    char slashname[] = "testfi/";
+    HANDLE find;
 
     filehandle = _lcreat( filename, 0 );
     if (filehandle == HFILE_ERROR)
@@ -257,6 +259,48 @@
     ok( INVALID_HANDLE_VALUE != FindFirstFileA( filename, &search_results ), "should STILL be able to find file" );
 
     ok( DeleteFileA( filename ) != 0, "DeleteFile failed (%ld)", GetLastError(  ) );
+
+    filehandle=_lcreat (slashname, 0); /* illegal name */
+    if (HFILE_ERROR==filehandle)
+      ok (0, "couldn't create file \"%s\" (err=%ld)", slashname,
+          GetLastError ());
+    else {
+      _lclose(filehandle);
+      find=FindFirstFileA (slashname, &search_results);
+      if (INVALID_HANDLE_VALUE==find)
+        ok (0, "file \"%s\" not found", slashname);
+      else {
+        ok (0!=FindClose (find), "FindClose complains (%ld)", GetLastError ());
+        slashname[strlen(slashname)-1]=0;
+        ok (!strcmp (slashname, search_results.cFileName),
+            "found unexpected name \"%s\"", search_results.cFileName);
+        ok (FILE_ATTRIBUTE_ARCHIVE==search_results.dwFileAttributes,
+            "attributes of file \"%s\" are 0x%04lx", search_results.cFileName,
+            search_results.dwFileAttributes);
+      }
+      ok (0!=DeleteFileA (slashname), "Can't delete \"%s\" (%ld)", slashname,
+          GetLastError ());
+    }
+
+    filehandle=_lcreat (filename, 8); /* illegal attribute */
+    if (HFILE_ERROR==filehandle)
+      ok (0, "couldn't create volume label \"%s\"", filename);
+    else {
+      _lclose(filehandle);
+      find=FindFirstFileA (filename, &search_results);
+      if (INVALID_HANDLE_VALUE==find)
+        ok (0, "file \"%s\" not found", filename);
+      else {
+        ok (0!=FindClose (find), "FindClose complains (%ld)", GetLastError ());
+        ok (!strcmp (filename, search_results.cFileName),
+            "found unexpected name \"%s\"", search_results.cFileName);
+        ok (FILE_ATTRIBUTE_ARCHIVE==search_results.dwFileAttributes,
+            "attributes of file \"%s\" are 0x%04lx", search_results.cFileName,
+            search_results.dwFileAttributes);
+      }
+      ok (0!=DeleteFileA (filename), "Can't delete \"%s\" (%ld)", slashname,
+          GetLastError ());
+    }
 }
 
 



More information about the wine-patches mailing list