/parser/htmlparser/tests/outsinks/TestOutSinks.pl

http://github.com/zpao/v8monkey · Perl · 128 lines · 56 code · 15 blank · 57 comment · 18 complexity · bf6ca63610bf9b51aa904440f1c40f16 MD5 · raw file

  1. #! /usr/bin/perl
  2. # ***** BEGIN LICENSE BLOCK *****
  3. # Version: MPL 1.1/GPL 2.0/LGPL 2.1
  4. #
  5. # The contents of this file are subject to the Mozilla Public License Version
  6. # 1.1 (the "License"); you may not use this file except in compliance with
  7. # the License. You may obtain a copy of the License at
  8. # http://www.mozilla.org/MPL/
  9. #
  10. # Software distributed under the License is distributed on an "AS IS" basis,
  11. # WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
  12. # for the specific language governing rights and limitations under the
  13. # License.
  14. #
  15. # The Original Code is Mozilla Communicator client code, released
  16. # March 31, 1998.
  17. #
  18. # The Initial Developer of the Original Code is
  19. # Netscape Communications Corporation.
  20. # Portions created by the Initial Developer are Copyright (C) 1998-1999
  21. # the Initial Developer. All Rights Reserved.
  22. #
  23. # Contributor(s):
  24. # Akkana Peck.
  25. #
  26. # Alternatively, the contents of this file may be used under the terms of
  27. # either of the GNU General Public License Version 2 or later (the "GPL"),
  28. # or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
  29. # in which case the provisions of the GPL or the LGPL are applicable instead
  30. # of those above. If you wish to allow use of your version of this file only
  31. # under the terms of either the GPL or the LGPL, and not to allow others to
  32. # use your version of this file under the terms of the MPL, indicate your
  33. # decision by deleting the provisions above and replace them with the notice
  34. # and other provisions required by the GPL or the LGPL. If you do not delete
  35. # the provisions above, a recipient may use your version of this file under
  36. # the terms of any one of the MPL, the GPL or the LGPL.
  37. #
  38. # ***** END LICENSE BLOCK *****
  39. #
  40. # This is a collection of test files to guard against regressions
  41. # in the Mozilla output system.
  42. # Documentation on the tests is available at:
  43. # http://www.mozilla.org/editor/serializer-tests.html
  44. #
  45. # Make sure . is in the path, so we can load the other shared libraries
  46. $ENV{LD_LIBRARY_PATH} .= ":.";
  47. $errmsg = "";
  48. # print "Testing simple html to html ...\n";
  49. # $status = system("./TestOutput -i text/html -o text/html -f 0 -c OutTestData/simple.html OutTestData/simple.html");
  50. # if ($status != 0) {
  51. # print "Simple html to html failed.\n";
  52. # $errmsg = "$errmsg simple.html";
  53. # }
  54. print "Testing simple copy case ...\n";
  55. $status = system("./TestOutput -i text/html -o text/plain -f 0 -w 0 -c OutTestData/simplecopy.out OutTestData/simple.html");
  56. if ($status != 0) {
  57. print "Simple copy test failed.\n";
  58. $errmsg = "$errmsg simplecopy.out";
  59. }
  60. print "Testing simple formatted copy case ...\n";
  61. $status = system("./TestOutput -i text/html -o text/plain -f 2 -w 0 -c OutTestData/simplecopy-formatted.out OutTestData/simple.html");
  62. if ($status != 0) {
  63. print "Simple formatted copy test failed.\n";
  64. $errmsg = "$errmsg simplecopy-formatted.out";
  65. }
  66. print "Testing simple html to plaintext formatting ...\n";
  67. $status = system("./TestOutput -i text/html -o text/plain -f 34 -w 70 -c OutTestData/simplefmt.out OutTestData/simple.html");
  68. if ($status != 0) {
  69. print("Simple formatting test failed.\n");
  70. $errmsg = "$errmsg simplefmt.out ";
  71. }
  72. print "Testing non-wrapped plaintext in preformatted mode ...\n";
  73. $status = system("./TestOutput -i text/html -o text/plain -f 16 -c OutTestData/plainnowrap.out OutTestData/plain.html");
  74. if ($status != 0) {
  75. print "Non-wrapped plaintext test failed.\n";
  76. $errmsg = "$errmsg plainnowrap.out";
  77. }
  78. # print "Testing wrapped and formatted plaintext ...\n";
  79. # $status = system("TestOutput -i text/html -o text/plain -f 32 -c OutTestData/plainwrap.out OutTestData/plain.html");
  80. # if ($status != 0) {
  81. # print "Wrapped plaintext test failed.\n";
  82. # $errmsg = "$errmsg plainwrap.out";
  83. # }
  84. print "Testing mail quoting ...\n";
  85. $status = system("./TestOutput -i text/html -o text/plain -f 2 -w 50 -c OutTestData/mailquote.out OutTestData/mailquote.html");
  86. if ($status != 0) {
  87. print "Mail quoting test failed.\n";
  88. $errmsg = "$errmsg mailquote.out";
  89. }
  90. print "Testing misc. HTML output with format=flowed ...\n";
  91. $status = system("./TestOutput -i text/html -o text/plain -f 2 -w 50 -c OutTestData/mischtml.out OutTestData/mischtml.html");
  92. if ($status != 0) {
  93. print "Misc. HTML with format=flowed test failed.\n";
  94. $errmsg = "$errmsg mischtml.out";
  95. }
  96. print "Testing format=flowed output ...\n";
  97. $status = system("./TestOutput -i text/html -o text/plain -f 66 -w 50 -c OutTestData/simplemail.out OutTestData/simplemail.html");
  98. if ($status != 0) {
  99. print "Format=flowed test failed.\n";
  100. $errmsg = "$errmsg simplemail.out";
  101. }
  102. print "Testing HTML Table to Text ...\n";
  103. $status = system("./TestOutput -i text/html -o text/plain -f 2 -c OutTestData/htmltable.out OutTestData/htmltable.html");
  104. if ($status != 0) {
  105. print "HTML Table to Plain text failed.\n";
  106. $errmsg = "$errmsg htmltable.out";
  107. }
  108. if ($errmsg ne "") {
  109. print "\nTEST-UNEXPECTED-FAIL | $errmsg\n";
  110. exit 1
  111. } else {
  112. print "\nTEST-PASS | TestOutSink\n";
  113. }