Add trailing '\n's to ok() calls (msvcrt)

Francois Gouget fgouget at free.fr
Mon Jan 26 17:41:41 CST 2004


Changelog:

 * dlls/msvcrt/tests/file.c
   dlls/msvcrt/tests/heap.c
   dlls/msvcrt/tests/scanf.c

   Add trailing '\n's to ok() calls.



Index: dlls/msvcrt/tests/file.c
===================================================================
RCS file: /home/cvs/wine/dlls/msvcrt/tests/file.c,v
retrieving revision 1.7
diff -u -r1.7 file.c
--- dlls/msvcrt/tests/file.c	30 Dec 2003 19:09:08 -0000	1.7
+++ dlls/msvcrt/tests/file.c	24 Jan 2004 20:03:40 -0000
@@ -42,8 +42,8 @@
     fd = open ("fdopen.tst", O_RDONLY | O_BINARY);
     lseek (fd, 5, SEEK_SET);
     file = fdopen (fd, "rb");
-    ok (fread (buffer, 1, sizeof (buffer), file) == 5, "read wrong byte count");
-    ok (memcmp (buffer, buffer + 5, 5) == 0, "read wrong bytes");
+    ok (fread (buffer, 1, sizeof (buffer), file) == 5, "read wrong byte count\n");
+    ok (memcmp (buffer, buffer + 5, 5) == 0, "read wrong bytes\n");
     fclose (file);
     unlink ("fdopen.tst");
 }
@@ -62,27 +62,27 @@

     fd = open ("fdopen.tst", O_RDONLY | O_BINARY);
     file = fdopen (fd, "rb");
-    ok(strlen(outbuffer) == (sizeof(outbuffer)-1),"strlen/sizeof error");
-    ok(fgets(buffer,sizeof(buffer),file) !=0,"fgets failed unexpected");
-    ok(fgets(buffer,sizeof(buffer),file) ==0,"fgets didn't signal EOF");
-    ok(feof(file) !=0,"feof doesn't signal EOF");
+    ok(strlen(outbuffer) == (sizeof(outbuffer)-1),"strlen/sizeof error\n");
+    ok(fgets(buffer,sizeof(buffer),file) !=0,"fgets failed unexpected\n");
+    ok(fgets(buffer,sizeof(buffer),file) ==0,"fgets didn't signal EOF\n");
+    ok(feof(file) !=0,"feof doesn't signal EOF\n");
     rewind(file);
-    ok(fgets(buffer,strlen(outbuffer),file) !=0,"fgets failed unexpected");
-    ok(lstrlenA(buffer) == strlen(outbuffer) -1,"fgets didn't read right size");
-    ok(fgets(buffer,sizeof(outbuffer),file) !=0,"fgets failed unexpected");
-    ok(strlen(buffer) == 1,"fgets dropped chars");
-    ok(buffer[0] == outbuffer[strlen(outbuffer)-1],"fgets exchanged chars");
+    ok(fgets(buffer,strlen(outbuffer),file) !=0,"fgets failed unexpected\n");
+    ok(lstrlenA(buffer) == strlen(outbuffer) -1,"fgets didn't read right size\n");
+    ok(fgets(buffer,sizeof(outbuffer),file) !=0,"fgets failed unexpected\n");
+    ok(strlen(buffer) == 1,"fgets dropped chars\n");
+    ok(buffer[0] == outbuffer[strlen(outbuffer)-1],"fgets exchanged chars\n");
     fclose (file);
     fd = open ("fdopen.tst", O_RDONLY | O_TEXT);
     file = fdopen (fd, "rt"); /* open in TEXT mode */
-    ok(fgetws(wbuffer,sizeof(wbuffer),file) !=0,"fgetws failed unexpected");
-    ok(fgetws(wbuffer,sizeof(wbuffer),file) ==0,"fgetws didn't signal EOF");
-    ok(feof(file) !=0,"feof doesn't signal EOF");
+    ok(fgetws(wbuffer,sizeof(wbuffer),file) !=0,"fgetws failed unexpected\n");
+    ok(fgetws(wbuffer,sizeof(wbuffer),file) ==0,"fgetws didn't signal EOF\n");
+    ok(feof(file) !=0,"feof doesn't signal EOF\n");
     rewind(file);
-    ok(fgetws(wbuffer,strlen(outbuffer),file) !=0,"fgetws failed unexpected");
-    ok(lstrlenW(wbuffer) == (strlen(outbuffer) -1),"fgetws didn't read right size");
-    ok(fgetws(wbuffer,sizeof(outbuffer),file) !=0,"fgets failed unexpected");
-    ok(lstrlenW(wbuffer) == 1,"fgets dropped chars");
+    ok(fgetws(wbuffer,strlen(outbuffer),file) !=0,"fgetws failed unexpected\n");
+    ok(lstrlenW(wbuffer) == (strlen(outbuffer) -1),"fgetws didn't read right size\n");
+    ok(fgetws(wbuffer,sizeof(outbuffer),file) !=0,"fgets failed unexpected\n");
+    ok(lstrlenW(wbuffer) == 1,"fgets dropped chars\n");
     fclose (file);
     unlink ("fdopen.tst");
 }
@@ -122,7 +122,7 @@
     {
       diff_found |= (*aptr != *wptr);
     }
-  ok(!(diff_found), "fgetwc difference found in TEXT mode");
+  ok(!(diff_found), "fgetwc difference found in TEXT mode\n");
   if(mytextW) free (mytextW);
   fclose(tempfh);
   unlink(tempf);
@@ -146,19 +146,19 @@
   fclose(tempfh);
   tempfh = fopen(tempf,"rb"); /* open in TEXT mode */
   fgets(btext,LLEN,tempfh);
-  ok( strlen(mytext) + 1 == strlen(btext),"TEXT/BINARY mode not handled for write");
-  ok( btext[strlen(mytext)-1] == '\r', "CR not written");
+  ok( strlen(mytext) + 1 == strlen(btext),"TEXT/BINARY mode not handled for write\n");
+  ok( btext[strlen(mytext)-1] == '\r', "CR not written\n");
   fclose(tempfh);
   tempfh = fopen(tempf,"wb"); /* open in BINARY mode */
   fputs(dostext,tempfh);
   fclose(tempfh);
   tempfh = fopen(tempf,"rt"); /* open in TEXT mode */
   fgets(btext,LLEN,tempfh);
-  ok(strcmp(btext, mytext) == 0,"_O_TEXT read doesn't strip CR");
+  ok(strcmp(btext, mytext) == 0,"_O_TEXT read doesn't strip CR\n");
   fclose(tempfh);
   tempfh = fopen(tempf,"rb"); /* open in TEXT mode */
   fgets(btext,LLEN,tempfh);
-  ok(strcmp(btext, dostext) == 0,"_O_BINARY read doesn't preserve CR");
+  ok(strcmp(btext, dostext) == 0,"_O_BINARY read doesn't preserve CR\n");

   fclose(tempfh);
   tempfh = fopen(tempf,"rt"); /* open in TEXT mode */
@@ -171,7 +171,7 @@
     {
       diff_found |= (*aptr != *wptr);
     }
-  ok(!(diff_found), "fgetwc doesn't strip CR in TEXT mode");
+  ok(!(diff_found), "fgetwc doesn't strip CR in TEXT mode\n");
   if(mytextW) free (mytextW);
   fclose(tempfh);
   unlink(tempf);
@@ -187,48 +187,48 @@
   tempf=_tempnam(".","wne");
   ok((tempfd = _open(tempf,_O_CREAT|_O_TRUNC|_O_TEXT|_O_RDWR,
                      _S_IREAD | _S_IWRITE)) != -1,
-     "Can't open '%s': %d", tempf, errno); /* open in TEXT mode */
+     "Can't open '%s': %d\n", tempf, errno); /* open in TEXT mode */
   ok(_write(tempfd,mytext,strlen(mytext)) == lstrlenA(mytext),
-     "_write _O_TEXT bad return value");
+     "_write _O_TEXT bad return value\n");
   _close(tempfd);
   tempfd = _open(tempf,_O_RDONLY|_O_BINARY,0); /* open in BINARY mode */
   ok(_read(tempfd,btext,LLEN) == lstrlenA(dostext),
-     "_read _O_BINARY got bad length");
+     "_read _O_BINARY got bad length\n");
   ok( memcmp(dostext,btext,strlen(dostext)) == 0,
-      "problems with _O_TEXT _write / _O_BINARY _read");
-  ok( btext[strlen(dostext)-2] == '\r', "CR not written or read");
+      "problems with _O_TEXT _write / _O_BINARY _read\n");
+  ok( btext[strlen(dostext)-2] == '\r', "CR not written or read\n");
   _close(tempfd);
   tempfd = _open(tempf,_O_RDONLY|_O_TEXT); /* open in TEXT mode */
   ok(_read(tempfd,btext,LLEN) == lstrlenA(mytext),
-     "_read _O_TEXT got bad length");
+     "_read _O_TEXT got bad length\n");
   ok( memcmp(mytext,btext,strlen(mytext)) == 0,
-      "problems with _O_TEXT _write / _read");
+      "problems with _O_TEXT _write / _read\n");
   _close(tempfd);
-  ok(unlink(tempf) !=-1 ,"Can't unlink '%s': %d", tempf, errno);
+  ok(unlink(tempf) !=-1 ,"Can't unlink '%s': %d\n", tempf, errno);

   tempf=_tempnam(".","wne");
   ok((tempfd = _open(tempf,_O_CREAT|_O_TRUNC|_O_BINARY|_O_RDWR,0)) != -1,
-     "Can't open '%s': %d", tempf, errno); /* open in BINARY mode */
+     "Can't open '%s': %d\n", tempf, errno); /* open in BINARY mode */
   ok(_write(tempfd,dostext,strlen(dostext)) == lstrlenA(dostext),
-     "_write _O_BINARY bad return value");
+     "_write _O_BINARY bad return value\n");
   _close(tempfd);
   tempfd = _open(tempf,_O_RDONLY|_O_BINARY,0); /* open in BINARY mode */
   ok(_read(tempfd,btext,LLEN) == lstrlenA(dostext),
-     "_read _O_BINARY got bad length");
+     "_read _O_BINARY got bad length\n");
   ok( memcmp(dostext,btext,strlen(dostext)) == 0,
-      "problems with _O_BINARY _write / _read");
-  ok( btext[strlen(dostext)-2] == '\r', "CR not written or read");
+      "problems with _O_BINARY _write / _read\n");
+  ok( btext[strlen(dostext)-2] == '\r', "CR not written or read\n");
   _close(tempfd);
   tempfd = _open(tempf,_O_RDONLY|_O_TEXT); /* open in TEXT mode */
   ok(_read(tempfd,btext,LLEN) == lstrlenA(mytext),
-     "_read _O_TEXT got bad length");
+     "_read _O_TEXT got bad length\n");
   ok( memcmp(mytext,btext,strlen(mytext)) == 0,
-      "problems with _O_BINARY _write / _O_TEXT _read");
+      "problems with _O_BINARY _write / _O_TEXT _read\n");
   _close(tempfd);

   ok(_chmod (tempf, _S_IREAD | _S_IWRITE) == 0,
-     "Can't chmod '%s' to read-write: %d", tempf, errno);
-  ok(unlink(tempf) !=-1 ,"Can't unlink '%s': %d", tempf, errno);
+     "Can't chmod '%s' to read-write: %d\n", tempf, errno);
+  ok(unlink(tempf) !=-1 ,"Can't unlink '%s': %d\n", tempf, errno);
 }

 static void test_tmpnam( void )
@@ -237,17 +237,17 @@
   char *res;

   res = tmpnam(NULL);
-  ok(res != NULL, "tmpnam returned NULL");
-  ok(res[0] == '\\', "first character is not a backslash");
-  ok(strchr(res+1, '\\') == 0, "file not in the root directory");
-  ok(res[strlen(res)-1] == '.', "first call - last character is not a dot");
+  ok(res != NULL, "tmpnam returned NULL\n");
+  ok(res[0] == '\\', "first character is not a backslash\n");
+  ok(strchr(res+1, '\\') == 0, "file not in the root directory\n");
+  ok(res[strlen(res)-1] == '.', "first call - last character is not a dot\n");

   res = tmpnam(name);
-  ok(res != NULL, "tmpnam returned NULL");
-  ok(res == name, "supplied buffer was not used");
-  ok(res[0] == '\\', "first character is not a backslash");
-  ok(strchr(res+1, '\\') == 0, "file not in the root directory");
-  ok(res[strlen(res)-1] != '.', "second call - last character is not a dot");
+  ok(res != NULL, "tmpnam returned NULL\n");
+  ok(res == name, "supplied buffer was not used\n");
+  ok(res[0] == '\\', "first character is not a backslash\n");
+  ok(strchr(res+1, '\\') == 0, "file not in the root directory\n");
+  ok(res[strlen(res)-1] != '.', "second call - last character is not a dot\n");
 }


Index: dlls/msvcrt/tests/heap.c
===================================================================
RCS file: /home/cvs/wine/dlls/msvcrt/tests/heap.c,v
retrieving revision 1.1
diff -u -r1.1 heap.c
--- dlls/msvcrt/tests/heap.c	20 Nov 2003 23:41:13 -0000	1.1
+++ dlls/msvcrt/tests/heap.c	24 Jan 2004 20:03:40 -0000
@@ -26,13 +26,13 @@
     void *mem = NULL;

     mem = realloc(mem, 10);
-    ok(mem != NULL, "memory not allocated");
+    ok(mem != NULL, "memory not allocated\n");

     mem = realloc(mem, 20);
-    ok(mem != NULL, "memory not reallocated");
+    ok(mem != NULL, "memory not reallocated\n");

     mem = realloc(mem, 0);
-    ok(mem == NULL, "memory nto freed");
+    ok(mem == NULL, "memory not freed\n");
 }

 START_TEST(heap)
Index: dlls/msvcrt/tests/scanf.c
===================================================================
RCS file: /home/cvs/wine/dlls/msvcrt/tests/scanf.c,v
retrieving revision 1.12
diff -u -r1.12 scanf.c
--- dlls/msvcrt/tests/scanf.c	6 Jan 2004 21:36:10 -0000	1.12
+++ dlls/msvcrt/tests/scanf.c	24 Jan 2004 20:03:40 -0000
@@ -36,65 +36,65 @@
     /* check EOF */
     strcpy(buffer,"");
     ret = sscanf(buffer, "%d", &result);
-    ok( ret == EOF,"sscanf returns %x instead of %x", ret, EOF );
+    ok( ret == EOF,"sscanf returns %x instead of %x\n", ret, EOF );

     /* check %x */
     strcpy(buffer,"0x519");
-    ok( sscanf(buffer, "%x", &result) == 1, "sscanf failed"  );
-    ok( result == 0x519,"sscanf reads %x instead of %x", result, 0x519 );
+    ok( sscanf(buffer, "%x", &result) == 1, "sscanf failed\n"  );
+    ok( result == 0x519,"sscanf reads %x instead of %x\n", result, 0x519 );

     strcpy(buffer,"0x51a");
-    ok( sscanf(buffer, "%x", &result) == 1, "sscanf failed" );
-    ok( result == 0x51a ,"sscanf reads %x instead of %x", result, 0x51a );
+    ok( sscanf(buffer, "%x", &result) == 1, "sscanf failed\n" );
+    ok( result == 0x51a ,"sscanf reads %x instead of %x\n", result, 0x51a );

     strcpy(buffer,"0x51g");
-    ok( sscanf(buffer, "%x", &result) == 1, "sscanf failed" );
-    ok( result == 0x51, "sscanf reads %x instead of %x", result, 0x51 );
+    ok( sscanf(buffer, "%x", &result) == 1, "sscanf failed\n" );
+    ok( result == 0x51, "sscanf reads %x instead of %x\n", result, 0x51 );

     /* check % followed by any char */
     strcpy(buffer,"\"%12@");
     strcpy(format,"%\"%%%d%@");  /* work around gcc format check */
-    ok( sscanf(buffer, format, &result) == 1, "sscanf failed" );
-    ok( result == 12, "sscanf reads %x instead of %x", result, 12 );
+    ok( sscanf(buffer, format, &result) == 1, "sscanf failed\n" );
+    ok( result == 12, "sscanf reads %x instead of %x\n", result, 12 );

     /* Check float */
     ret = sprintf(buffer,"%f %f",res1, res2);
     ret = sscanf(buffer,"%f%f",&res11, &res12);
-    ok( (res11 == res1) && (res12 == res2), "Error reading floats");
+    ok( (res11 == res1) && (res12 == res2), "Error reading floats\n");

     /* check strings */
     ret = sprintf(buffer," %s", pname);
     ret = sscanf(buffer,"%*c%[^\n]",buffer1);
-    ok( ret == 1, "Error with format \"%s\"","%*c%[^\n]");
-    ok( strncmp(pname,buffer1,strlen(buffer1)) == 0, "Error with \"%s\" \"%s\"",pname, buffer1);
+    ok( ret == 1, "Error with format \"%s\"\n","%*c%[^\n]");
+    ok( strncmp(pname,buffer1,strlen(buffer1)) == 0, "Error with \"%s\" \"%s\"\n",pname, buffer1);

     ret = sscanf("abcefgdh","%*[a-cg-e]%c",&buffer[0]);
-    ok( ret == 1, "Error with format \"%s\"","%*[a-cg-e]%c");
-    ok( buffer[0] == 'd', "Error with \"abcefgdh\" \"%c\"", buffer[0]);
+    ok( ret == 1, "Error with format \"%s\"\n","%*[a-cg-e]%c");
+    ok( buffer[0] == 'd', "Error with \"abcefgdh\" \"%c\"\n", buffer[0]);

     ret = sscanf("abcefgdh","%*[a-cd-dg-e]%c",&buffer[0]);
-    ok( ret == 1, "Error with format \"%s\"","%*[a-cd-dg-e]%c");
-    ok( buffer[0] == 'h', "Error with \"abcefgdh\" \"%c\"", buffer[0]);
+    ok( ret == 1, "Error with format \"%s\"\n","%*[a-cd-dg-e]%c");
+    ok( buffer[0] == 'h', "Error with \"abcefgdh\" \"%c\"\n", buffer[0]);

     /* check digits */
     ret = sprintf(buffer,"%d:%d:%d",hour,min,sec);
     ret = sscanf(buffer,"%d%n",&number,&number_so_far);
-    ok(ret == 1 , "problem with format arg \"%%d%%n\"");
-    ok(number == hour,"Read wrong arg %d instead of %d",number, hour);
-    ok(number_so_far == 2,"Read wrong arg for \"%%n\" %d instead of 2",number_so_far);
+    ok(ret == 1 , "problem with format arg \"%%d%%n\"\n");
+    ok(number == hour,"Read wrong arg %d instead of %d\n",number, hour);
+    ok(number_so_far == 2,"Read wrong arg for \"%%n\" %d instead of 2\n",number_so_far);

     ret = sscanf(buffer+2,"%*c%n",&number_so_far);
-    ok(ret == 0 , "problem with format arg \"%%*c%%n\"");
-    ok(number_so_far == 1,"Read wrong arg for \"%%n\" %d instead of 2",number_so_far);
+    ok(ret == 0 , "problem with format arg \"%%*c%%n\"\n");
+    ok(number_so_far == 1,"Read wrong arg for \"%%n\" %d instead of 2\n",number_so_far);

     /* Check %i according to bug 1878 */
     strcpy(buffer,"123");
     ret = sscanf(buffer, "%i", &result);
-    ok( ret == 1 , "Wrong number of arguments read");
-    ok(result == 123, "Wrong number read");
+    ok( ret == 1 , "Wrong number of arguments read\n");
+    ok(result == 123, "Wrong number read\n");
     ret = sscanf(buffer, "%d", &result);
-    ok( ret == 1 , "Wrong number of arguments read");
-    ok(result == 123, "Wrong number read");
+    ok( ret == 1 , "Wrong number of arguments read\n");
+    ok(result == 123, "Wrong number read\n");
 }

 static void test_sprintf( void )
@@ -140,11 +140,11 @@
         const int valid  = n < 0 ? bufsiz : (n == bufsiz ? n : n+1);

         todo (tests[i].todo.retval ? "wine" : "none")
-            ok (n == expect, "\"%s\": expected %d, returned %d",
+            ok (n == expect, "\"%s\": expected %d, returned %d\n",
                 fmt, expect, n);
         todo (tests[i].todo.render ? "wine" : "none")
             ok (!memcmp (fmt, buffer, valid),
-                "\"%s\": rendered \"%.*s\"", fmt, valid, buffer);
+                "\"%s\": rendered \"%.*s\"\n", fmt, valid, buffer);
     };
 }




-- 
Francois Gouget         fgouget at free.fr        http://fgouget.free.fr/
           Cahn's Axiom: When all else fails, read the instructions.



More information about the wine-patches mailing list