More on 19428: fix the output tests on windows. r=cmanske, a=rickg.

git-svn-id: svn://10.0.0.236/trunk@61629 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
akkana%netscape.com
2000-02-25 01:09:37 +00:00
parent f24101c1f1
commit eb98d76923
4 changed files with 50 additions and 18 deletions

View File

@@ -66,17 +66,33 @@ Compare(nsString& str, nsString& aFileName)
// Inefficiently read from the file:
nsString inString;
char c;
int index = 0;
int different = 0;
while ((c = getc(file)) != EOF)
{
inString += c;
// CVS isn't doing newline comparisons on these files for some reason.
// So compensate for possible newline problems in the CVS file:
if (c == '\n' && str[index] == '\r')
++index;
if (c != str[index++])
{
//printf("Comparison failed at char %d: generated was %d, file had %d\n",
// index, (int)str[index-1], (int)c);
different = index;
break;
}
}
if (file != stdin)
fclose(file);
if (str == inString)
if (!different)
return 0;
else
{
char* cstr = str.ToNewCString();
printf("Comparison failed:\n-----\n%s\n-----\n", cstr);
char* cstr = str.ToNewUTF8String();
printf("Comparison failed at char %d:\n-----\n%s\n-----\n",
different, cstr);
Recycle(cstr);
return 1;
}