Update tests to use maybe_plan.
[dbsrgits/SQL-Translator.git] / t / 29html.t
index b4e3ebd..f1f48fc 100644 (file)
@@ -9,18 +9,20 @@
 use strict;
 use vars qw(%HANDLERS);
 use Test::More;
+use Test::SQL::Translator qw(maybe_plan);
 use SQL::Translator;
 
-my ($p, $tables, $classes);
-eval {
-    require HTML::Parser;
-    $p = HTML::Parser->new(api_version => 3);
-    $p->strict_names(1); 
-};
-if ($@) {
-    plan skip_all => "Missing HTML::Parser";
+BEGIN {
+    maybe_plan(5,
+        'HTML::Parser',
+        'SQL::Translator::Parser::MySQL',
+        'SQL::Translator::Producer::HTML');
 }
 
+my ($p, $tables, $classes);
+$p = HTML::Parser->new(api_version => 3);
+$p->strict_names(1); 
+
 my $create = q|
 CREATE TABLE foo (
     int id PRIMARY KEY AUTO_INCREMENT NOT NULL,
@@ -36,13 +38,9 @@ eval {
     $status = $p->parse($parsed);    
 };
 if ($@) {
-    plan tests => 1;
     fail("Unable to parse the output!");
-    exit 1;
 }
 
-plan tests => 5;
-
 # General
 ok($parsed, "Parsed table OK");
 ok($status, "Parsed HTML OK");
@@ -50,7 +48,7 @@ ok($status, "Parsed HTML OK");
 $p->handler(start => @{$HANDLERS{count_tables}});
 $p->parse($parsed);
 
-is($tables, 2, "One table in the SQL produces 2 <table> tags");
+is($tables, 3, "One table in the SQL produces 3 <table> tags");
 $tables = $classes = 0;
 
 $p->handler(start => @{$HANDLERS{count_classes}});