PageRenderTime 25ms CodeModel.GetById 12ms app.highlight 11ms RepoModel.GetById 1ms app.codeStats 0ms

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