From 163649cbd064d02bfd9e508fce24b4c8b987bd4e Mon Sep 17 00:00:00 2001 From: "akkana%netscape.com" Date: Fri, 1 Oct 1999 20:55:01 +0000 Subject: [PATCH] Automated tests of output. Not part of apprunner, not built by default. Fix Compare() function; add lots of before and after files for testing various regressions; add a TestOutSinks script which tests the known cases. git-svn-id: svn://10.0.0.236/trunk@49596 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/htmlparser/tests/outsinks/Convert.cpp | 69 ++++++++++++------- mozilla/htmlparser/tests/outsinks/Makefile.in | 11 ++- .../htmlparser/tests/outsinks/TestOutSinks | 69 +++++++++++++++++++ .../htmlparser/tests/outsinks/entityxif.out | 2 + .../htmlparser/tests/outsinks/mailquote.html | 42 +++++++++++ .../htmlparser/tests/outsinks/mailquote.out | 9 +++ mozilla/htmlparser/tests/outsinks/plain.html | 39 +++++++++++ .../htmlparser/tests/outsinks/plainnowrap.out | 8 +++ .../htmlparser/tests/outsinks/plainwrap.html | 2 +- .../htmlparser/tests/outsinks/plainwrap.out | 14 ++++ mozilla/htmlparser/tests/outsinks/simple.html | 38 ++++++++++ .../htmlparser/tests/outsinks/simplecopy.out | 3 + .../htmlparser/tests/outsinks/Convert.cpp | 69 ++++++++++++------- .../htmlparser/tests/outsinks/Makefile.in | 11 ++- .../htmlparser/tests/outsinks/TestOutSinks | 69 +++++++++++++++++++ .../htmlparser/tests/outsinks/entityxif.out | 2 + .../htmlparser/tests/outsinks/mailquote.html | 42 +++++++++++ .../htmlparser/tests/outsinks/mailquote.out | 9 +++ .../htmlparser/tests/outsinks/plain.html | 39 +++++++++++ .../htmlparser/tests/outsinks/plainnowrap.out | 8 +++ .../htmlparser/tests/outsinks/plainwrap.html | 2 +- .../htmlparser/tests/outsinks/plainwrap.out | 14 ++++ .../htmlparser/tests/outsinks/simple.html | 38 ++++++++++ .../htmlparser/tests/outsinks/simplecopy.out | 3 + 24 files changed, 560 insertions(+), 52 deletions(-) create mode 100755 mozilla/htmlparser/tests/outsinks/TestOutSinks create mode 100644 mozilla/htmlparser/tests/outsinks/entityxif.out create mode 100644 mozilla/htmlparser/tests/outsinks/mailquote.html create mode 100644 mozilla/htmlparser/tests/outsinks/mailquote.out create mode 100644 mozilla/htmlparser/tests/outsinks/plain.html create mode 100644 mozilla/htmlparser/tests/outsinks/plainnowrap.out create mode 100644 mozilla/htmlparser/tests/outsinks/plainwrap.out create mode 100644 mozilla/htmlparser/tests/outsinks/simple.html create mode 100644 mozilla/htmlparser/tests/outsinks/simplecopy.out create mode 100755 mozilla/parser/htmlparser/tests/outsinks/TestOutSinks create mode 100644 mozilla/parser/htmlparser/tests/outsinks/entityxif.out create mode 100644 mozilla/parser/htmlparser/tests/outsinks/mailquote.html create mode 100644 mozilla/parser/htmlparser/tests/outsinks/mailquote.out create mode 100644 mozilla/parser/htmlparser/tests/outsinks/plain.html create mode 100644 mozilla/parser/htmlparser/tests/outsinks/plainnowrap.out create mode 100644 mozilla/parser/htmlparser/tests/outsinks/plainwrap.out create mode 100644 mozilla/parser/htmlparser/tests/outsinks/simple.html create mode 100644 mozilla/parser/htmlparser/tests/outsinks/simplecopy.out diff --git a/mozilla/htmlparser/tests/outsinks/Convert.cpp b/mozilla/htmlparser/tests/outsinks/Convert.cpp index 06003d148a0..91f88f988d5 100644 --- a/mozilla/htmlparser/tests/outsinks/Convert.cpp +++ b/mozilla/htmlparser/tests/outsinks/Convert.cpp @@ -47,21 +47,42 @@ static NS_DEFINE_IID(kParserCID, NS_PARSER_IID); // Interface IID's static NS_DEFINE_IID(kIParserIID, NS_IPARSER_IID); -nsresult -Compare(nsString& str, nsString& filename) +int +Compare(nsString& str, nsString& aFileName) { - printf("Sorry, don't know how to compare yet\n"); - char* charstar = str.ToNewUTF8String(); - printf("Output string is: %s\n-------------------- \n", charstar); - delete[] charstar; - return NS_ERROR_NOT_IMPLEMENTED; + // Open the file in a Unix-centric way, + // until I find out how to use nsFileSpec: + char* filename = aFileName.ToNewCString(); + FILE* file = fopen(filename, "r"); + if (!file) + { + fprintf(stderr, "Can't open file %s", filename); + perror(" "); + delete[] filename; + return 2; + } + delete[] filename; + + // Inefficiently read from the file: + nsString inString; + char c; + while ((c = getc(file)) != EOF) + inString += c; + if (file != stdin) + fclose(file); + + if (str == inString) + return 0; + else + return 1; } //---------------------------------------------------------------------- // Convert html on stdin to either plaintext or (if toHTML) html //---------------------------------------------------------------------- nsresult -HTML2text(nsString& inString, nsString& inType, nsString& outType, int wrapCol, nsString& compareAgainst) +HTML2text(nsString& inString, nsString& inType, nsString& outType, + int flags, int wrapCol, nsString& compareAgainst) { nsresult rv = NS_OK; @@ -81,10 +102,10 @@ HTML2text(nsString& inString, nsString& inType, nsString& outType, int wrapCol, // Create the appropriate output sink if (outType == "text/html") - rv = NS_New_HTML_ContentSinkStream(&sink, &outString, 0); + rv = NS_New_HTML_ContentSinkStream(&sink, &outString, flags); else // default to plaintext - rv = NS_New_HTMLToTXT_SinkStream(&sink, &outString, wrapCol, 2); + rv = NS_New_HTMLToTXT_SinkStream(&sink, &outString, wrapCol, flags); if (NS_FAILED(rv)) { @@ -123,7 +144,7 @@ HTML2text(nsString& inString, nsString& inType, nsString& outType, int wrapCol, return Compare(outString, compareAgainst); char* charstar = outString.ToNewUTF8String(); - printf("Output string is:\n--------------------\n%s\n--------------------\n", + printf("Output string is:\n--------------------\n%s--------------------\n", charstar); delete[] charstar; @@ -137,6 +158,7 @@ int main(int argc, char** argv) nsString inType ("text/html"); nsString outType ("text/plain"); int wrapCol = 72; + int flags = 0; nsString compareAgainst; @@ -151,11 +173,11 @@ int main(int argc, char** argv) { case 'h': printf("\ -Usage: %s [-i intype] [-o outtype] [-w wrapcol] [-c comparison_file] infile\n\ +Usage: %s [-i intype] [-o outtype] [-f flags] [-w wrapcol] [-c comparison_file] infile\n\ \tIn/out types are mime types (e.g. text/html)\n\ \tcomparison_file is a file against which to compare the output\n\ \t (not yet implemented\n\ -\tDefaults are -i text/html -o text/plain -w 72 [stdin]\n", +\tDefaults are -i text/html -o text/plain -f 0 -w 72 [stdin]\n", progname); exit(0); @@ -189,6 +211,16 @@ Usage: %s [-i intype] [-o outtype] [-w wrapcol] [-c comparison_file] infile\n\ } break; + case 'f': + if (isdigit(argv[0][2])) + flags = atoi(argv[0]+2); + else { + flags = atoi(argv[1]); + --argc; + ++argv; + } + break; + case 'c': if (argv[0][2] != '\0') compareAgainst = argv[0]+2; @@ -230,14 +262,5 @@ Usage: %s [-i intype] [-o outtype] [-w wrapcol] [-c comparison_file] infile\n\ if (file != stdin) fclose(file); -#if 0 - printf("Input string is: %s\n-------------------- \n", - inString.ToNewCString()); - printf("------------------------------------\n"); -#endif - - printf("inType = '%s', outType = '%s'\n", inType.ToNewCString(), outType.ToNewCString()); - HTML2text(inString, inType, outType, wrapCol, compareAgainst); - - return 0; + return HTML2text(inString, inType, outType, flags, wrapCol, compareAgainst); } diff --git a/mozilla/htmlparser/tests/outsinks/Makefile.in b/mozilla/htmlparser/tests/outsinks/Makefile.in index a1512361d5d..8fd04033d1c 100644 --- a/mozilla/htmlparser/tests/outsinks/Makefile.in +++ b/mozilla/htmlparser/tests/outsinks/Makefile.in @@ -30,19 +30,26 @@ CPPSRCS = \ $(NULL) LIBS = \ - -lraptorhtmlpars \ -lxpcom \ $(NSPR_LIBS) \ $(NULL) TEST_FILES = \ - plainwrap.html \ + plain.html \ + plainwrap.out \ + plainnowrap.out \ + simple.html \ + simplecopy.out \ entityxif.xif \ + entityxif.out \ + mailquote.html \ + mailquote.out \ $(NULL) include $(topsrcdir)/config/rules.mk install:: $(INSTALL) -m 555 $(PROGRAM) $(DIST)/bin + $(INSTALL) -m 555 TestOutSinks $(DIST)/bin $(INSTALL) $(TEST_FILES) $(DIST)/bin/OutTestData diff --git a/mozilla/htmlparser/tests/outsinks/TestOutSinks b/mozilla/htmlparser/tests/outsinks/TestOutSinks new file mode 100755 index 00000000000..eea3f702b02 --- /dev/null +++ b/mozilla/htmlparser/tests/outsinks/TestOutSinks @@ -0,0 +1,69 @@ +#! /bin/tcsh -f + +# The contents of this file are subject to the Netscape Public +# License Version 1.1 (the "License"); you may not use this file +# except in compliance with the License. You may obtain a copy of +# the License at http://www.mozilla.org/NPL/ +# +# Software distributed under the License is distributed on an "AS +# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or +# implied. See the License for the specific language governing +# rights and limitations under the License. +# +# The Original Code is Mozilla Communicator client code, released +# March 31, 1998. +# +# The Initial Developer of the Original Code is Netscape +# Communications Corporation. Portions created by Netscape are +# Copyright (C) 1998-1999 Netscape Communications Corporation. All +# Rights Reserved. +# +# Contributor(s): Akkana Peck. + +# +# This is a collection of test files to guard against regressions +# in the Gecko output system. +# + +set errmsg = "" + +echo "Testing simple copy cases ..." +TestOutput -i text/html -o text/plain -f 0 -w 0 -c OutTestData/simplecopy.out OutTestData/simple.html +if ($status != 0) then + echo "Simple copy test failed.\n" + set errmsg = ($errmsg "simple.out") +endif + +echo "Testing non-wrapped plaintext ..." +TestOutput -i text/html -o text/plain -w 0 -c OutTestData/plainnowrap.out OutTestData/plain.html +if ($status != 0) then + echo "Non-wrapped plaintext test failed." + set errmsg = ($errmsg "plainnowrap.out") +endif + +echo "Testing wrapped plaintext ..." +TestOutput -i text/html -o text/plain -f 32 -w 50 -c OutTestData/plainwrap.out OutTestData/plain.html +if ($status != 0) then + echo "Wrapped plaintext test failed." + set errmsg = ($errmsg "plainwrap.out") +endif + +echo "Testing mail quoting ..." +TestOutput -i text/html -o text/plain -c OutTestData/mailquote.out OutTestData/mailquote.html +if ($status != 0) then + echo "Mail quoting test failed." + set errmsg = ($errmsg "mailquote.out") +endif + +echo "Testing conversion of XIF entities ..." +TestOutput -i text/xif -o text/plain -c OutTestData/entityxif.out OutTestData/entityxif.xif +if ($status != 0) then + echo "XIF entity convertsion test failed." + set errmsg = ($errmsg "entityxif.out") +endif + +if (errmsg != "") then + echo " " + echo TESTS FAILED: $errmsg + exit 1 +endif diff --git a/mozilla/htmlparser/tests/outsinks/entityxif.out b/mozilla/htmlparser/tests/outsinks/entityxif.out new file mode 100644 index 00000000000..b46ce23cffa --- /dev/null +++ b/mozilla/htmlparser/tests/outsinks/entityxif.out @@ -0,0 +1,2 @@ + +http://www.hotbot.com/?MT=Search+Engines&SM=MC&DV=0&LG=any&DC=10&DE=2&BT=H&Search.x=31&Search.y=7r diff --git a/mozilla/htmlparser/tests/outsinks/mailquote.html b/mozilla/htmlparser/tests/outsinks/mailquote.html new file mode 100644 index 00000000000..1bfe2244c0b --- /dev/null +++ b/mozilla/htmlparser/tests/outsinks/mailquote.html @@ -0,0 +1,42 @@ + + +Ender Plain Text Test Page + + + + +This page is a text of mail quoting. +

+ +

+I hope you will enjoy this quote from Hamlet, introduced by a fairly long line to see how quotations get wrapped: +

+To be, or not to be, that is the question
+Whether 'tis nobler in the mind to suffer
+The slings and fortunes of outrageous fortune
+Or to take arms against a sea of troubles
+And by opposing end them.
+

+ + + diff --git a/mozilla/htmlparser/tests/outsinks/mailquote.out b/mozilla/htmlparser/tests/outsinks/mailquote.out new file mode 100644 index 00000000000..7bbe0efbf9e --- /dev/null +++ b/mozilla/htmlparser/tests/outsinks/mailquote.out @@ -0,0 +1,9 @@ +This page is a text of mail quoting. + +> I hope you will enjoy this quote from Hamlet, introduced by a fairly long line to see how quotations get wrapped: +> +> To be, or not to be, that is the question +> Whether 'tis nobler in the mind to suffer +> The slings and fortunes of outrageous fortune +> Or to take arms against a sea of troubles +> And by opposing end them. diff --git a/mozilla/htmlparser/tests/outsinks/plain.html b/mozilla/htmlparser/tests/outsinks/plain.html new file mode 100644 index 00000000000..a79529b1c01 --- /dev/null +++ b/mozilla/htmlparser/tests/outsinks/plain.html @@ -0,0 +1,39 @@ + + +Ender Plain Text Test Page + + + + +80 char width (for reference only): +---------|---------|---------|---------|---------|---------|---------|---------| +Here is a link to mozilla.org. +Here is some underlined and boldenedified text. +This is a test to make sure the output converters pick up the moz-pre-wrap style. They don't necessarily have to pick up the exact wrap setting. + +- This should be tested with wrapping on. +- This should be tested with wrapping off. + +This is the end. + + diff --git a/mozilla/htmlparser/tests/outsinks/plainnowrap.out b/mozilla/htmlparser/tests/outsinks/plainnowrap.out new file mode 100644 index 00000000000..d87bca54633 --- /dev/null +++ b/mozilla/htmlparser/tests/outsinks/plainnowrap.out @@ -0,0 +1,8 @@ +80 char width (for reference only): +---------|---------|---------|---------|---------|---------|---------|---------| +Here is a link to mozilla.org. +Here is some underlined and boldenedified text. +This is a test to make sure the output converters pick up the moz-pre-wrap style. They don't necessarily have to pick up the exact wrap setting. +- This should be tested with wrapping on. +- This should be tested with wrapping off. +This is the end. diff --git a/mozilla/htmlparser/tests/outsinks/plainwrap.html b/mozilla/htmlparser/tests/outsinks/plainwrap.html index ee5dfff7a61..2bd6b19920a 100644 --- a/mozilla/htmlparser/tests/outsinks/plainwrap.html +++ b/mozilla/htmlparser/tests/outsinks/plainwrap.html @@ -18,7 +18,7 @@ -- Copyright (C) 1998-1999 Netscape Communications Corporation. All -- Rights Reserved. -- - -- Contributor(s): + -- Contributor(s): Akkana Peck --> Ender Plain Text Test Page diff --git a/mozilla/htmlparser/tests/outsinks/plainwrap.out b/mozilla/htmlparser/tests/outsinks/plainwrap.out new file mode 100644 index 00000000000..f6cdb0921ae --- /dev/null +++ b/mozilla/htmlparser/tests/outsinks/plainwrap.out @@ -0,0 +1,14 @@ +80 char width (for reference only): +---------|---------|---------|---------|---------|---------|---------|---------| +Here is a +link to mozilla.org. +Here is some underlined and boldenedified +text. +This is a test to make sure the output converters +pick up the moz-pre-wrap style. They don't +necessarily have to pick up the exact wrap +setting. +- This should be tested with wrapping on. +- This should be tested with wrapping off. +This is the end. + diff --git a/mozilla/htmlparser/tests/outsinks/simple.html b/mozilla/htmlparser/tests/outsinks/simple.html new file mode 100644 index 00000000000..13076781d1e --- /dev/null +++ b/mozilla/htmlparser/tests/outsinks/simple.html @@ -0,0 +1,38 @@ + + +Simple html page + + + +

Simple html page

+ +Here is a link to the mozilla.org page. +Here is some underlined and boldenedified text. + +

+Here is a line ending with a space +followed by a line break. +The output should contain only one space between "space" and "followed". + + + diff --git a/mozilla/htmlparser/tests/outsinks/simplecopy.out b/mozilla/htmlparser/tests/outsinks/simplecopy.out new file mode 100644 index 00000000000..1bd474dba49 --- /dev/null +++ b/mozilla/htmlparser/tests/outsinks/simplecopy.out @@ -0,0 +1,3 @@ +Simple html page Here is a link to mozilla.org. Here is some underlined and boldenedified text. +Here is a line ending with a space followed by a line break. The output should contain only one space between "space" and "followed". + diff --git a/mozilla/parser/htmlparser/tests/outsinks/Convert.cpp b/mozilla/parser/htmlparser/tests/outsinks/Convert.cpp index 06003d148a0..91f88f988d5 100644 --- a/mozilla/parser/htmlparser/tests/outsinks/Convert.cpp +++ b/mozilla/parser/htmlparser/tests/outsinks/Convert.cpp @@ -47,21 +47,42 @@ static NS_DEFINE_IID(kParserCID, NS_PARSER_IID); // Interface IID's static NS_DEFINE_IID(kIParserIID, NS_IPARSER_IID); -nsresult -Compare(nsString& str, nsString& filename) +int +Compare(nsString& str, nsString& aFileName) { - printf("Sorry, don't know how to compare yet\n"); - char* charstar = str.ToNewUTF8String(); - printf("Output string is: %s\n-------------------- \n", charstar); - delete[] charstar; - return NS_ERROR_NOT_IMPLEMENTED; + // Open the file in a Unix-centric way, + // until I find out how to use nsFileSpec: + char* filename = aFileName.ToNewCString(); + FILE* file = fopen(filename, "r"); + if (!file) + { + fprintf(stderr, "Can't open file %s", filename); + perror(" "); + delete[] filename; + return 2; + } + delete[] filename; + + // Inefficiently read from the file: + nsString inString; + char c; + while ((c = getc(file)) != EOF) + inString += c; + if (file != stdin) + fclose(file); + + if (str == inString) + return 0; + else + return 1; } //---------------------------------------------------------------------- // Convert html on stdin to either plaintext or (if toHTML) html //---------------------------------------------------------------------- nsresult -HTML2text(nsString& inString, nsString& inType, nsString& outType, int wrapCol, nsString& compareAgainst) +HTML2text(nsString& inString, nsString& inType, nsString& outType, + int flags, int wrapCol, nsString& compareAgainst) { nsresult rv = NS_OK; @@ -81,10 +102,10 @@ HTML2text(nsString& inString, nsString& inType, nsString& outType, int wrapCol, // Create the appropriate output sink if (outType == "text/html") - rv = NS_New_HTML_ContentSinkStream(&sink, &outString, 0); + rv = NS_New_HTML_ContentSinkStream(&sink, &outString, flags); else // default to plaintext - rv = NS_New_HTMLToTXT_SinkStream(&sink, &outString, wrapCol, 2); + rv = NS_New_HTMLToTXT_SinkStream(&sink, &outString, wrapCol, flags); if (NS_FAILED(rv)) { @@ -123,7 +144,7 @@ HTML2text(nsString& inString, nsString& inType, nsString& outType, int wrapCol, return Compare(outString, compareAgainst); char* charstar = outString.ToNewUTF8String(); - printf("Output string is:\n--------------------\n%s\n--------------------\n", + printf("Output string is:\n--------------------\n%s--------------------\n", charstar); delete[] charstar; @@ -137,6 +158,7 @@ int main(int argc, char** argv) nsString inType ("text/html"); nsString outType ("text/plain"); int wrapCol = 72; + int flags = 0; nsString compareAgainst; @@ -151,11 +173,11 @@ int main(int argc, char** argv) { case 'h': printf("\ -Usage: %s [-i intype] [-o outtype] [-w wrapcol] [-c comparison_file] infile\n\ +Usage: %s [-i intype] [-o outtype] [-f flags] [-w wrapcol] [-c comparison_file] infile\n\ \tIn/out types are mime types (e.g. text/html)\n\ \tcomparison_file is a file against which to compare the output\n\ \t (not yet implemented\n\ -\tDefaults are -i text/html -o text/plain -w 72 [stdin]\n", +\tDefaults are -i text/html -o text/plain -f 0 -w 72 [stdin]\n", progname); exit(0); @@ -189,6 +211,16 @@ Usage: %s [-i intype] [-o outtype] [-w wrapcol] [-c comparison_file] infile\n\ } break; + case 'f': + if (isdigit(argv[0][2])) + flags = atoi(argv[0]+2); + else { + flags = atoi(argv[1]); + --argc; + ++argv; + } + break; + case 'c': if (argv[0][2] != '\0') compareAgainst = argv[0]+2; @@ -230,14 +262,5 @@ Usage: %s [-i intype] [-o outtype] [-w wrapcol] [-c comparison_file] infile\n\ if (file != stdin) fclose(file); -#if 0 - printf("Input string is: %s\n-------------------- \n", - inString.ToNewCString()); - printf("------------------------------------\n"); -#endif - - printf("inType = '%s', outType = '%s'\n", inType.ToNewCString(), outType.ToNewCString()); - HTML2text(inString, inType, outType, wrapCol, compareAgainst); - - return 0; + return HTML2text(inString, inType, outType, flags, wrapCol, compareAgainst); } diff --git a/mozilla/parser/htmlparser/tests/outsinks/Makefile.in b/mozilla/parser/htmlparser/tests/outsinks/Makefile.in index a1512361d5d..8fd04033d1c 100644 --- a/mozilla/parser/htmlparser/tests/outsinks/Makefile.in +++ b/mozilla/parser/htmlparser/tests/outsinks/Makefile.in @@ -30,19 +30,26 @@ CPPSRCS = \ $(NULL) LIBS = \ - -lraptorhtmlpars \ -lxpcom \ $(NSPR_LIBS) \ $(NULL) TEST_FILES = \ - plainwrap.html \ + plain.html \ + plainwrap.out \ + plainnowrap.out \ + simple.html \ + simplecopy.out \ entityxif.xif \ + entityxif.out \ + mailquote.html \ + mailquote.out \ $(NULL) include $(topsrcdir)/config/rules.mk install:: $(INSTALL) -m 555 $(PROGRAM) $(DIST)/bin + $(INSTALL) -m 555 TestOutSinks $(DIST)/bin $(INSTALL) $(TEST_FILES) $(DIST)/bin/OutTestData diff --git a/mozilla/parser/htmlparser/tests/outsinks/TestOutSinks b/mozilla/parser/htmlparser/tests/outsinks/TestOutSinks new file mode 100755 index 00000000000..eea3f702b02 --- /dev/null +++ b/mozilla/parser/htmlparser/tests/outsinks/TestOutSinks @@ -0,0 +1,69 @@ +#! /bin/tcsh -f + +# The contents of this file are subject to the Netscape Public +# License Version 1.1 (the "License"); you may not use this file +# except in compliance with the License. You may obtain a copy of +# the License at http://www.mozilla.org/NPL/ +# +# Software distributed under the License is distributed on an "AS +# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or +# implied. See the License for the specific language governing +# rights and limitations under the License. +# +# The Original Code is Mozilla Communicator client code, released +# March 31, 1998. +# +# The Initial Developer of the Original Code is Netscape +# Communications Corporation. Portions created by Netscape are +# Copyright (C) 1998-1999 Netscape Communications Corporation. All +# Rights Reserved. +# +# Contributor(s): Akkana Peck. + +# +# This is a collection of test files to guard against regressions +# in the Gecko output system. +# + +set errmsg = "" + +echo "Testing simple copy cases ..." +TestOutput -i text/html -o text/plain -f 0 -w 0 -c OutTestData/simplecopy.out OutTestData/simple.html +if ($status != 0) then + echo "Simple copy test failed.\n" + set errmsg = ($errmsg "simple.out") +endif + +echo "Testing non-wrapped plaintext ..." +TestOutput -i text/html -o text/plain -w 0 -c OutTestData/plainnowrap.out OutTestData/plain.html +if ($status != 0) then + echo "Non-wrapped plaintext test failed." + set errmsg = ($errmsg "plainnowrap.out") +endif + +echo "Testing wrapped plaintext ..." +TestOutput -i text/html -o text/plain -f 32 -w 50 -c OutTestData/plainwrap.out OutTestData/plain.html +if ($status != 0) then + echo "Wrapped plaintext test failed." + set errmsg = ($errmsg "plainwrap.out") +endif + +echo "Testing mail quoting ..." +TestOutput -i text/html -o text/plain -c OutTestData/mailquote.out OutTestData/mailquote.html +if ($status != 0) then + echo "Mail quoting test failed." + set errmsg = ($errmsg "mailquote.out") +endif + +echo "Testing conversion of XIF entities ..." +TestOutput -i text/xif -o text/plain -c OutTestData/entityxif.out OutTestData/entityxif.xif +if ($status != 0) then + echo "XIF entity convertsion test failed." + set errmsg = ($errmsg "entityxif.out") +endif + +if (errmsg != "") then + echo " " + echo TESTS FAILED: $errmsg + exit 1 +endif diff --git a/mozilla/parser/htmlparser/tests/outsinks/entityxif.out b/mozilla/parser/htmlparser/tests/outsinks/entityxif.out new file mode 100644 index 00000000000..b46ce23cffa --- /dev/null +++ b/mozilla/parser/htmlparser/tests/outsinks/entityxif.out @@ -0,0 +1,2 @@ + +http://www.hotbot.com/?MT=Search+Engines&SM=MC&DV=0&LG=any&DC=10&DE=2&BT=H&Search.x=31&Search.y=7r diff --git a/mozilla/parser/htmlparser/tests/outsinks/mailquote.html b/mozilla/parser/htmlparser/tests/outsinks/mailquote.html new file mode 100644 index 00000000000..1bfe2244c0b --- /dev/null +++ b/mozilla/parser/htmlparser/tests/outsinks/mailquote.html @@ -0,0 +1,42 @@ + + +Ender Plain Text Test Page + + + + +This page is a text of mail quoting. +

+ +

+I hope you will enjoy this quote from Hamlet, introduced by a fairly long line to see how quotations get wrapped: +

+To be, or not to be, that is the question
+Whether 'tis nobler in the mind to suffer
+The slings and fortunes of outrageous fortune
+Or to take arms against a sea of troubles
+And by opposing end them.
+

+ + + diff --git a/mozilla/parser/htmlparser/tests/outsinks/mailquote.out b/mozilla/parser/htmlparser/tests/outsinks/mailquote.out new file mode 100644 index 00000000000..7bbe0efbf9e --- /dev/null +++ b/mozilla/parser/htmlparser/tests/outsinks/mailquote.out @@ -0,0 +1,9 @@ +This page is a text of mail quoting. + +> I hope you will enjoy this quote from Hamlet, introduced by a fairly long line to see how quotations get wrapped: +> +> To be, or not to be, that is the question +> Whether 'tis nobler in the mind to suffer +> The slings and fortunes of outrageous fortune +> Or to take arms against a sea of troubles +> And by opposing end them. diff --git a/mozilla/parser/htmlparser/tests/outsinks/plain.html b/mozilla/parser/htmlparser/tests/outsinks/plain.html new file mode 100644 index 00000000000..a79529b1c01 --- /dev/null +++ b/mozilla/parser/htmlparser/tests/outsinks/plain.html @@ -0,0 +1,39 @@ + + +Ender Plain Text Test Page + + + + +80 char width (for reference only): +---------|---------|---------|---------|---------|---------|---------|---------| +Here is a link to mozilla.org. +Here is some underlined and boldenedified text. +This is a test to make sure the output converters pick up the moz-pre-wrap style. They don't necessarily have to pick up the exact wrap setting. + +- This should be tested with wrapping on. +- This should be tested with wrapping off. + +This is the end. + + diff --git a/mozilla/parser/htmlparser/tests/outsinks/plainnowrap.out b/mozilla/parser/htmlparser/tests/outsinks/plainnowrap.out new file mode 100644 index 00000000000..d87bca54633 --- /dev/null +++ b/mozilla/parser/htmlparser/tests/outsinks/plainnowrap.out @@ -0,0 +1,8 @@ +80 char width (for reference only): +---------|---------|---------|---------|---------|---------|---------|---------| +Here is a link to mozilla.org. +Here is some underlined and boldenedified text. +This is a test to make sure the output converters pick up the moz-pre-wrap style. They don't necessarily have to pick up the exact wrap setting. +- This should be tested with wrapping on. +- This should be tested with wrapping off. +This is the end. diff --git a/mozilla/parser/htmlparser/tests/outsinks/plainwrap.html b/mozilla/parser/htmlparser/tests/outsinks/plainwrap.html index ee5dfff7a61..2bd6b19920a 100644 --- a/mozilla/parser/htmlparser/tests/outsinks/plainwrap.html +++ b/mozilla/parser/htmlparser/tests/outsinks/plainwrap.html @@ -18,7 +18,7 @@ -- Copyright (C) 1998-1999 Netscape Communications Corporation. All -- Rights Reserved. -- - -- Contributor(s): + -- Contributor(s): Akkana Peck --> Ender Plain Text Test Page diff --git a/mozilla/parser/htmlparser/tests/outsinks/plainwrap.out b/mozilla/parser/htmlparser/tests/outsinks/plainwrap.out new file mode 100644 index 00000000000..f6cdb0921ae --- /dev/null +++ b/mozilla/parser/htmlparser/tests/outsinks/plainwrap.out @@ -0,0 +1,14 @@ +80 char width (for reference only): +---------|---------|---------|---------|---------|---------|---------|---------| +Here is a +link to mozilla.org. +Here is some underlined and boldenedified +text. +This is a test to make sure the output converters +pick up the moz-pre-wrap style. They don't +necessarily have to pick up the exact wrap +setting. +- This should be tested with wrapping on. +- This should be tested with wrapping off. +This is the end. + diff --git a/mozilla/parser/htmlparser/tests/outsinks/simple.html b/mozilla/parser/htmlparser/tests/outsinks/simple.html new file mode 100644 index 00000000000..13076781d1e --- /dev/null +++ b/mozilla/parser/htmlparser/tests/outsinks/simple.html @@ -0,0 +1,38 @@ + + +Simple html page + + + +

Simple html page

+ +Here is a link to the mozilla.org page. +Here is some underlined and boldenedified text. + +

+Here is a line ending with a space +followed by a line break. +The output should contain only one space between "space" and "followed". + + + diff --git a/mozilla/parser/htmlparser/tests/outsinks/simplecopy.out b/mozilla/parser/htmlparser/tests/outsinks/simplecopy.out new file mode 100644 index 00000000000..1bd474dba49 --- /dev/null +++ b/mozilla/parser/htmlparser/tests/outsinks/simplecopy.out @@ -0,0 +1,3 @@ +Simple html page Here is a link to mozilla.org. Here is some underlined and boldenedified text. +Here is a line ending with a space followed by a line break. The output should contain only one space between "space" and "followed". +