Uwe Bonnes : msvcrt/tests: Test case to show Wine still mishandles file text mode.
Alexandre Julliard
julliard at winehq.org
Wed Jan 28 08:03:26 CST 2009
Module: wine
Branch: master
Commit: d0e77f8a47016c6f69e3a6b5a8bed8f620f1a8f1
URL: http://source.winehq.org/git/wine.git/?a=commit;h=d0e77f8a47016c6f69e3a6b5a8bed8f620f1a8f1
Author: Uwe Bonnes <bon at elektron.ikp.physik.tu-darmstadt.de>
Date: Sun Jan 25 18:56:04 2009 +0100
msvcrt/tests: Test case to show Wine still mishandles file text mode.
---
dlls/msvcrt/tests/file.c | 40 ++++++++++++++++++++++++++++++++++++++++
1 files changed, 40 insertions(+), 0 deletions(-)
diff --git a/dlls/msvcrt/tests/file.c b/dlls/msvcrt/tests/file.c
index 44ca961..b783b51 100644
--- a/dlls/msvcrt/tests/file.c
+++ b/dlls/msvcrt/tests/file.c
@@ -306,6 +306,7 @@ static void test_asciimode(void)
{
FILE *fp;
char buf[64];
+ int c, i, j;
/* Simple test of CR CR LF handling. Test both fgets and fread code paths, they're different! */
fp = fopen("ascii.tst", "wb");
@@ -334,6 +335,45 @@ static void test_asciimode(void)
ok((fread(buf, 1, sizeof(buf), fp) == 0), "fread after logical EOF\n");
fclose(fp);
+ /* Show ASCII mode handling*/
+ fp= fopen("ascii.tst","wb");
+ fputs("0\r\n1\r\n2\r\n3\r\n4\r\n5\r\n6\r\n7\r\n8\r\n9\r\n", fp);
+ fclose(fp);
+
+ fp = fopen("ascii.tst", "r");
+ c= fgetc(fp);
+ c= fgetc(fp);
+ fseek(fp,0,SEEK_CUR);
+ todo_wine {
+ for(i=1; i<10; i++) {
+ ok((j = ftell(fp)) == i*3, "ftell fails in TEXT mode\n");
+ fseek(fp,0,SEEK_CUR);
+ ok((c = fgetc(fp)) == '0'+ i, "fgetc after fseek failed in line %d\n", i);
+ c= fgetc(fp);
+ }
+ /* Show that fseek doesn't skip \\r !*/
+ rewind(fp);
+ c= fgetc(fp);
+ fseek(fp, 2 ,SEEK_CUR);
+ for(i=1; i<10; i++) {
+ ok((c = fgetc(fp)) == '0'+ i, "fgetc after fseek with pos Offset failed in line %d\n", i);
+ fseek(fp, 2 ,SEEK_CUR);
+ }
+ fseek(fp, 9*3 ,SEEK_SET);
+ c = fgetc(fp);
+ fseek(fp, -4 ,SEEK_CUR);
+ for(i= 8; i>=0; i--) {
+ ok((c = fgetc(fp)) == '0'+ i, "fgetc after fseek with neg Offset failed in line %d\n", i);
+ fseek(fp, -4 ,SEEK_CUR);
+ }
+ }
+ /* Show what happens is fseek positions filepointer on \\r */
+ fclose(fp);
+ fp = fopen("ascii.tst", "r");
+ fseek(fp, 3 ,SEEK_SET);
+ ok((c = fgetc(fp)) == '1', "fgetc fails to read nect char when positioned on \\r \n");
+ fclose(fp);
+
unlink("ascii.tst");
}
More information about the wine-cvs
mailing list