wine/dlls/msvcrt/tests file.c

Alexandre Julliard julliard at wine.codeweavers.com
Mon Nov 21 05:58:11 CST 2005


ChangeSet ID:	21352
CVSROOT:	/opt/cvs-commit
Module name:	wine
Changes by:	julliard at winehq.org	2005/11/21 05:58:11

Modified files:
	dlls/msvcrt/tests: file.c 

Log message:
	Saulius Krasuckas <saulius.krasuckas at ieee.org>
	Minor MSVCRT test changes:
	- add two invalid parameter checks for fopen(),
	- rearrange test sequence into two parts (low-level and stream I/O),
	- break long line.

Patch: http://cvs.winehq.org/patch.py?id=21352

Old revision  New revision  Changes     Path
 1.20          1.21          +16 -5      wine/dlls/msvcrt/tests/file.c

Index: wine/dlls/msvcrt/tests/file.c
diff -u -p wine/dlls/msvcrt/tests/file.c:1.20 wine/dlls/msvcrt/tests/file.c:1.21
--- wine/dlls/msvcrt/tests/file.c:1.20	21 Nov 2005 11:58:11 -0000
+++ wine/dlls/msvcrt/tests/file.c	21 Nov 2005 11:58:11 -0000
@@ -411,7 +411,7 @@ static void test_fopen_fclose_fcloseall(
     char fname1[] = "empty1";
     char fname2[] = "empty2";
     char fname3[] = "empty3";
-    FILE *stream1, *stream2, *stream3;
+    FILE *stream1, *stream2, *stream3, *stream4;
     int ret, numclosed;
 
     /* testing fopen() */
@@ -424,6 +424,14 @@ static void test_fopen_fclose_fcloseall(
     ok(stream3 == NULL, "The file '%s' shouldn't exist before\n", fname3 );
     stream3 = fopen(fname3, "w+");
     ok(stream3 != NULL, "The file '%s' should be opened now\n", fname3 );
+    errno = 0xfaceabad;
+    stream4 = fopen("", "w+");
+    ok(stream4 == NULL && errno == ENOENT, 
+       "filename is empty, errno = %d (expected 2)\n", errno);
+    errno = 0xfaceabad;
+    stream4 = fopen(NULL, "w+");
+    ok(stream4 == NULL && (errno == EINVAL || errno == ENOENT), 
+       "filename is NULL, errno = %d (expected 2 or 22)\n", errno);
 
     /* testing fclose() */
     ret = fclose(stream2);
@@ -454,19 +462,22 @@ START_TEST(file)
 
     arg_c = winetest_get_mainargs( &arg_v );
 
+    /* testing low-level I/O */
     if (arg_c >= 3)
     {
-	if (arg_c == 3) test_file_inherit_child(arg_v[2]); else test_file_inherit_child_no(arg_v[2]);
+        if (arg_c == 3) test_file_inherit_child(arg_v[2]); 
+        else test_file_inherit_child_no(arg_v[2]);
         return;
     }
+    test_file_inherit(arg_v[0]);
+    test_file_write_read();
+    test_chsize();
 
+    /* testing stream I/O */
     test_fdopen();
     test_fopen_fclose_fcloseall();
     test_fileops();
     test_fgetwc();
     test_file_put_get();
-    test_file_write_read();
-    test_file_inherit(arg_v[0]);
     test_tmpnam();
-    test_chsize();
 }



More information about the wine-cvs mailing list