Bug 593758 - Part 2: unit tests for the plaintext serializer; r=bzbarsky a=blocking-betaN+

--HG--
rename : parser/htmlparser/tests/outsinks/simplecopy.out => parser/htmlparser/tests/outsinks/simplecopy-formatted.out
This commit is contained in:
Ehsan Akhgari 2010-10-13 01:34:20 -04:00
Родитель 6eb0a8f0a1
Коммит aeb5412ed5
7 изменённых файлов: 57 добавлений и 25 удалений

Просмотреть файл

@ -91,6 +91,10 @@ Compare(nsString& str, nsString& aFileName)
break;
}
}
// Read the rest of the file
while ((c = getc(file)) != EOF) {
inString.Append(PRUnichar(c));
}
if (file != stdin)
fclose(file);
@ -98,11 +102,11 @@ Compare(nsString& str, nsString& aFileName)
return 0;
else
{
nsAutoString left;
str.Left(left, different);
char* cstr = ToNewUTF8String(left);
printf("Comparison failed at char %d:\n-----\n%s\n-----\n",
different, cstr);
char* cexpected = ToNewUTF8String(inString);
char* cstr = ToNewUTF8String(str);
printf("Comparison failed at char %d:\nGot:\n-----\n%s\n-----\nExpected:\n-----\n%s\n-----\n",
different, cstr, cexpected);
Recycle(cexpected);
Recycle(cstr);
return 1;
}

Просмотреть файл

@ -61,6 +61,7 @@ TEST_FILES = \
plainnowrap.out \
simple.html \
simplecopy.out \
simplecopy-formatted.out \
simplefmt.out \
entityxif.xif \
entityxif.out \
@ -85,9 +86,9 @@ libs::
$(INSTALL) -m 555 $(srcdir)/TestOutSinks.pl $(DIST)/bin
$(INSTALL) $(addprefix $(srcdir)/, $(TEST_FILES)) $(DIST)/bin/OutTestData
install::
$(SYSINSTALL) -m 555 $(srcdir)/TestOutSinks.pl $(DESTDIR)$(mozappdir)
$(SYSINSTALL) $(addprefix $(srcdir)/, $(TEST_FILES)) $(DESTDIR)$(mozappdir)/OutTestData
check::
@$(EXIT_ON_ERROR) \
( cd $(DIST)/bin && $(PERL) ./TestOutSinks.pl )
ifeq ($(OS_ARCH),WINNT)
ifndef GNU_CC

Просмотреть файл

@ -64,6 +64,13 @@ if ($status != 0) {
$errmsg = "$errmsg simplecopy.out";
}
print "Testing simple formatted copy case ...\n";
$status = system("./TestOutput -i text/html -o text/plain -f 2 -w 0 -c OutTestData/simplecopy-formatted.out OutTestData/simple.html");
if ($status != 0) {
print "Simple formatted copy test failed.\n";
$errmsg = "$errmsg simplecopy-formatted.out";
}
print "Testing simple html to plaintext formatting ...\n";
$status = system("./TestOutput -i text/html -o text/plain -f 34 -w 70 -c OutTestData/simplefmt.out OutTestData/simple.html");
if ($status != 0) {
@ -114,9 +121,8 @@ if ($status != 0) {
}
if ($errmsg ne "") {
print "\nERROR: DOM SERIALIZER TEST FAILED: $errmsg\n";
print "See http://www.mozilla.org/editor/serializer-tests.html for help.\n";
print "\nTEST-UNEXPECTED-FAIL | $errmsg\n";
exit 1
} else {
print "DOM SERIALIZER TESTS SUCCEEDED\n";
print "\nTEST-PASS | TestOutSink\n";
}

Просмотреть файл

@ -0,0 +1,22 @@
Simple html page
Here is a link to the mozilla.org <http://www.mozilla.org> page. Here is some _underlined and *bold*ened_ified text plus some <angle bracket entities>.
Here is a line ending with a space followed by a line break. Plaintext output should contain only one space (and no line breaks) between "space" and "followed".
Here is a /list/:
* An item
* A nested ordered list:
*
1. item one
2. item two
* last item
Here is a paragraph after the list.
Here is a blockquote:
The quick brown fox jumped over the lazy dog

Просмотреть файл

@ -5,11 +5,10 @@ Here is a line ending with a space followed by a line break. Plaintext output sh
Here is a list:
* An item
* A nested ordered list:
*
1. item one
2. item two
* last item
An item
A nested ordered list:
item one
item two
last item
Here is a paragraph after the list.

Просмотреть файл

@ -11,12 +11,12 @@ output should contain only one space (and no line breaks) between
Here is a /list/:
* An item
* A nested ordered list:
*
1. item one
2. item two
* last item
* An item
* A nested ordered list:
*
1. item one
2. item two
* last item
Here is a paragraph after the list.

Просмотреть файл

@ -9,7 +9,7 @@ line is.
Testing Space stuffing
From shouldn't start a line.
Nor a space.
Nor a space.
> Neither should a greater-than symbol.
--
Above is NOT a sig delimiter since it's missing
@ -17,4 +17,4 @@ the trailing SPACE:
--
Above is a sig delimiter. I hope.
A sig (wow!).
A sig (wow!).