Permalink
Browse files

* fixed numerous tests to report proper reason for skipping via skip_…

…all()

* other changes to tests to make them work correctly, or bail politely
  under perl 5.8.0


git-svn-id: svn://svn.tt2.org/tt/Template2/trunk@518 d5a88997-0a34-4036-9ed2-92fb5d660d91
  • Loading branch information...
1 parent 488c03a commit 039bd377279461bb9c821221f428a261120119f8 @abw committed Aug 12, 2002
Showing with 41 additions and 32 deletions.
  1. +4 −1 t/autoform.t
  2. +1 −2 t/cgi.t
  3. +2 −2 t/dbi.t
  4. +1 −2 t/directry.t
  5. +1 −1 t/dom.t
  6. +1 −1 t/domview.t
  7. +1 −2 t/file.t
  8. +1 −1 t/gd.t
  9. +1 −1 t/gdgraph.t
  10. +1 −1 t/gdgraph3d.t
  11. +1 −1 t/gdtext.t
  12. +1 −1 t/gdtextalign.t
  13. +1 −1 t/gdtextwrap.t
  14. +10 −2 t/html.t
  15. +1 −1 t/latex2dvi.t
  16. +1 −1 t/latex2pdf.t
  17. +1 −1 t/latex2ps.t
  18. +1 −1 t/pod.t
  19. +2 −1 t/rss.t
  20. +3 −3 t/stash-xs.t
  21. +3 −2 t/tiedhash.t
  22. +1 −2 t/wrap.t
  23. +1 −1 t/xpath.t
View
@@ -29,7 +29,10 @@ $Template::Test::PRESERVE = 1;
eval "use Text::Autoformat";
if ($@) {
- exit(0);
+ skip_all('Text::Autoformat module not installed');
+}
+if ($] == 5.008) {
+ skip_all('Text::Autoformat tests unreliable under 5.8.0');
}
# for testing known bug with locales that don't use '.' as a decimal
View
@@ -28,8 +28,7 @@ $^W = 1;
eval "use CGI";
if ($@) {
- print "1..0\n";
- exit(0);
+ skip_all("no CGI module");
}
View
@@ -23,7 +23,7 @@ $Template::Test::PRESERVE = 1;
eval "use DBI";
if ($@) {
- exit(0);
+ skip_all("DBI module not installed");
}
eval "use Tie::DBI";
my $tiedbi = $@ ? 0 : 1;
@@ -34,7 +34,7 @@ my $tiedbi = $@ ? 0 : 1;
# the $run, $dsn, $user and $pass variables.
require 'dbi_test.cfg';
unless ($run) {
- exit(0);
+ skip_all('skipping DBI tests at user request');
}
# new feature in DBI plugin v2.30+ is to allow user to drop initial 'dbi:'
View
@@ -22,8 +22,7 @@ use Cwd;
$^W = 1;
if ($^O eq 'MSWin32') {
- print "1..0\n";
- exit(0);
+ skip_all('skipping tests on MS Win 32 platform');
}
#$Template::Test::PRESERVE = 1;
View
@@ -32,7 +32,7 @@ my $shut_up_warnings = $XML::DOM::VERSION;
eval "use XML::DOM";
if ($@ || $XML::DOM::VERSION < 1.27) {
- exit(0);
+ skip_all("XML::DOM v1.27 or later not installed");
}
# account for script being run in distribution root or 't' directory
View
@@ -31,7 +31,7 @@ my $shut_up_warnings = $XML::DOM::VERSION;
eval "use XML::DOM";
if ($@ || $XML::DOM::VERSION < 1.27) {
- exit(0);
+ skip_all("XML::DOM v1.27 or later not installed");
}
test_expect(\*DATA);
View
@@ -22,8 +22,7 @@ use Template::Plugin::File;
$^W = 1;
if ($^O eq 'MSWin32') {
- print "1..0\n";
- exit(0);
+ skip_all('skipping tests on MS Win 32 platform');
}
#
View
@@ -22,7 +22,7 @@ $^W = 1;
eval "use GD;";
if ( $@ || $GD::VERSION < 1.20 ) {
- exit(0);
+ skip_all('GD module(s) not installed');
}
test_expect(\*DATA, { FILTERS => {
View
@@ -24,7 +24,7 @@ $^W = 1;
eval "use GD; use GD::Graph;";
if ( $@ || $GD::VERSION < 1.20 ) {
- exit(0);
+ skip_all('GD module(s) not installed');
}
test_expect(\*DATA, { FILTERS => {
View
@@ -24,7 +24,7 @@ $^W = 1;
eval "use GD; use GD::Graph; use GD::Graph::bars3d;";
if ( $@ || $GD::VERSION < 1.20 ) {
- exit(0);
+ skip_all('GD module(s) not installed');
}
test_expect(\*DATA, { FILTERS => {
View
@@ -22,7 +22,7 @@ $^W = 1;
eval "use GD; use GD::Text;";
if ( $@ || $GD::VERSION < 1.20 ) {
- exit(0);
+ skip_all('GD module(s) not installed');
}
test_expect(\*DATA);
View
@@ -23,7 +23,7 @@ $^W = 1;
eval "use GD; use GD::Text::Align;";
if ( $@ || $GD::VERSION < 1.20 ) {
- exit(0);
+ skip_all('GD module(s) not installed');
}
test_expect(\*DATA);
View
@@ -23,7 +23,7 @@ $^W = 1;
eval "use GD; use GD::Text::Wrap;";
if ( $@ || $GD::VERSION < 1.20 ) {
- exit(0);
+ skip_all('GD module(s) not installed');
}
test_expect(\*DATA);
View
@@ -22,7 +22,7 @@ use Template::Test;
use Template::Plugin::HTML;
$^W = 1;
-$Template::Test::DEBUG = 0;
+$Template::Test::DEBUG = 1;
$Template::Test::PRESERVE = 1;
#------------------------------------------------------------------------
@@ -52,19 +52,22 @@ test_expect(\*DATA, $cfg, $vars);
__DATA__
-- test --
+-- name html plugin --
[% USE HTML -%]
OK
-- expect --
OK
-- test --
+-- name html filter --
[% FILTER html -%]
< &amp; >
[%- END %]
-- expect --
&lt; &amp;amp; &gt;
-- test --
+-- name html entity --
[% TRY;
"Léon Brocard" | html_entity;
CATCH;
@@ -75,8 +78,10 @@ OK
-- process --
[% IF entities -%]
L&eacute;on Brocard
+[% "IN ENTITIES" | stderr -%]
[%- ELSE -%]
-html_all error - cannot locate Apache::Util or HTML::Entities
+[% "NOT IN ENTITIES" | stderr -%]
+html_entity error - cannot locate Apache::Util or HTML::Entities
[%- END %]
-- test --
@@ -85,18 +90,21 @@ html_all error - cannot locate Apache::Util or HTML::Entities
my%20file.html
-- test --
+-- name escape --
[% USE HTML -%]
[% HTML.escape("if (a < b && c > d) ...") %]
-- expect --
if (a &lt; b &amp;&amp; c &gt; d) ...
-- test --
+-- name sorted --
[% USE HTML(sorted=1) -%]
[% HTML.element(table => { border => 1, cellpadding => 2 }) %]
-- expect --
<table border="1" cellpadding="2">
-- test --
+-- name attributes --
[% USE HTML -%]
[% HTML.attributes(border => 1, cellpadding => 2).split.sort.join %]
-- expect --
View
@@ -28,7 +28,7 @@ my($LaTeXPath, $PdfLaTeXPath, $DviPSPath) = @{Template::Config->latexpaths()};
# We need a non-empty $LaTeXPath to convert to DVI
#
if ( $LaTeXPath eq "" ) {
- exit(0);
+ skip_all('LaTeX not installed');
}
test_expect(\*DATA, { FILTERS => {
View
@@ -28,7 +28,7 @@ my($LaTeXPath, $PdfLaTeXPath, $DviPSPath) = @{Template::Config->latexpaths()};
# We need a non-empty $PdfLaTeXPath to convert to PDF
#
if ( $PdfLaTeXPath eq "" ) {
- exit(0);
+ skip_all('LaTeX not installed');
}
test_expect(\*DATA, { FILTERS => {
View
@@ -29,7 +29,7 @@ my($LaTeXPath, $PdfLaTeXPath, $DviPSPath) = @{Template::Config->latexpaths()};
# We need a non-empty $LaTeXPath and $DviPSPath to convert to PS
#
if ( $LaTeXPath eq "" || $DviPSPath eq "" ) {
- exit(0);
+ skip_all('LaTeX not installed');
}
test_expect(\*DATA, { FILTERS => {
View
@@ -27,7 +27,7 @@ $Template::Test::PRESERVE = 1;
eval "use Pod::POM";
if ($@) {
- exit(0);
+ skip_all('Pod::POM not installed');
}
my $config = {
View
@@ -27,7 +27,8 @@ $^W = 1;
my $shut_up_warnings = $XML::RSS::VERSION;
eval "use XML::RSS";
-exit if $@ || ($] == 5.006 && $XML::RSS::VERSION < 0.9);
+skip_all('XML::RSS v 0.9 or later not installed')
+ if $@ || ($] == 5.006 && $XML::RSS::VERSION < 0.9);
# account for script being run in distribution root or 't' directory
my $file = abs_path( -d 't' ? 't/test/xml' : 'test/xml' );
View
@@ -25,11 +25,11 @@ use Template::Test;
$^W = 1;
eval {
- require Template::Stash::XS;
+ require Template::Stash::XS;
};
if ($@) {
- warn $@;
- exit(0);
+ warn $@;
+ skip_all('cannot load Template::Stash::XS');
}
my $count = 20;
View
@@ -23,10 +23,11 @@ use Template::Stash;
$^W = 1;
eval {
- require Template::Stash::XS;
+ require Template::Stash::XS;
};
if ($@) {
- exit(0);
+ warn $@;
+ skip_all('cannot load Template::Stash::XS');
}
#print "stash: $Template::Config::STASH\n";
View
@@ -28,8 +28,7 @@ $Template::Test::DEBUG = 0;
eval "use Text::Wrap";
if ($@) {
- print "1..0\n";
- exit(0);
+ skip_all('Text::Wrap not installed');
}
test_expect(\*DATA);
View
@@ -29,7 +29,7 @@ my $shut_up_warnings = $XML::XPath::VERSION;
eval "use XML::XPath";
if ($@ || $XML::XPath::VERSION < 1.0) {
- exit(0);
+ skip_all('XML::XPath v1.0 or later not installed');
}
# account for script being run in distribution root or 't' directory

0 comments on commit 039bd37

Please sign in to comment.