From: Darren Chamberlain Date: Wed, 4 Feb 2004 17:34:27 +0000 (+0000) Subject: Robustify the tests a little. X-Git-Tag: v0.06~218 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=fbc0552f2fa97295f7ffd616b7ed8af30e8e025e;p=dbsrgits%2FSQL-Translator.git Robustify the tests a little. --- diff --git a/t/02mysql-parser.t b/t/02mysql-parser.t index 56609bf..3aa829a 100644 --- a/t/02mysql-parser.t +++ b/t/02mysql-parser.t @@ -4,11 +4,21 @@ use strict; -use Test::More tests => 180; +use Test::More; use SQL::Translator; -use SQL::Translator::Parser::MySQL qw(parse); use SQL::Translator::Schema::Constants; +eval { + require SQL::Translator::Parser::MySQL; + SQL::Translator::Parser::MySQL->import('parse'); +}; +if ($@) { + plan skip_all => "$@"; +} +else { + plan tests => 180; +} + { my $tr = SQL::Translator->new; my $data = q|create table sessions ( diff --git a/t/05bgep-re.t b/t/05bgep-re.t index d5b5992..435f8ce 100644 --- a/t/05bgep-re.t +++ b/t/05bgep-re.t @@ -10,6 +10,12 @@ use FindBin qw($Bin); use SQL::Translator; use Test::More tests => 2; +# This aggravates me; XML::Writer produces tons of warnings. +local $SIG{__WARN__} = sub { + CORE::warn(@_) + unless $_[0] =~ m#XML/Writer#; +}; + my @data = qw(data mysql BGEP-RE-create.sql); my $test_data = (-d "t") ? catfile($Bin, @data) diff --git a/t/06xsv.t b/t/06xsv.t index 065f71c..4c12665 100644 --- a/t/06xsv.t +++ b/t/06xsv.t @@ -8,8 +8,18 @@ use strict; use SQL::Translator; use SQL::Translator::Schema; use SQL::Translator::Schema::Constants; -use SQL::Translator::Parser::xSV qw(parse); -use Test::More tests => 25; +use Test::More; + +eval { + require SQL::Translator::Parser::xSV; + SQL::Translator::Parser::xSV->import('parse'); +}; +if ($@) { + plan skip_all => "$@"; +} +else { + plan tests => 25; +} my $tr = SQL::Translator->new; my $s = SQL::Translator::Schema->new; diff --git a/t/10excel.t b/t/10excel.t index a5acc66..7bee0de 100644 --- a/t/10excel.t +++ b/t/10excel.t @@ -1,11 +1,21 @@ #!/usr/bin/perl # vim: set ft=perl: -use Test::More tests => 31; +use Test::More; use SQL::Translator; -use SQL::Translator::Parser::Excel 'parse'; use SQL::Translator::Schema::Constants; +eval { + require SQL::Translator::Parser::Excel; + SQL::Translator::Parser::Excel->import('parse'); +}; +if ($@) { + plan skip_all => "$@"; +} +else { + plan tests => 31; +} + my $tr = SQL::Translator->new(parser => "Excel"); my $t = $tr->translate(filename => "t/data/Excel/t.xls"); my $schema = $tr->schema; diff --git a/t/14postgres-parser.t b/t/14postgres-parser.t index c28eea5..d81abe1 100644 --- a/t/14postgres-parser.t +++ b/t/14postgres-parser.t @@ -1,10 +1,21 @@ #!/usr/bin/perl +# vim: set ft=perl: use strict; -use Test::More tests => 117; +use Test::More; use SQL::Translator; use SQL::Translator::Schema::Constants; -use SQL::Translator::Parser::PostgreSQL qw(parse); + +eval { + require SQL::Translator::Parser::PostgreSQL; + SQL::Translator::Parser::PostgreSQL->import('parse'); +}; +if ($@) { + plan skip_all => "$@"; +} +else { + plan tests => 117; +} my $t = SQL::Translator->new( trace => 0 ); my $sql = q[ diff --git a/t/15oracle-parser.t b/t/15oracle-parser.t index 1c064d5..6377ad2 100644 --- a/t/15oracle-parser.t +++ b/t/15oracle-parser.t @@ -1,10 +1,21 @@ #!/usr/bin/perl +# vim: set ft=perl: use strict; -use Test::More tests => 76; +use Test::More; use SQL::Translator; use SQL::Translator::Schema::Constants; -use SQL::Translator::Parser::Oracle qw(parse); + +eval { + require SQL::Translator::Parser::Oracle; + SQL::Translator::Parser::Oracle->import('parse'); +}; +if ($@) { + plan skip_all => "$@"; +} +else { + plan tests => 76; +} my $t = SQL::Translator->new( trace => 0 ); my $sql = q[ diff --git a/t/17sqlfxml-producer.t b/t/17sqlfxml-producer.t index 29acb01..79f28a1 100644 --- a/t/17sqlfxml-producer.t +++ b/t/17sqlfxml-producer.t @@ -20,6 +20,10 @@ use FindBin qw/$Bin/; my $file = "$Bin/data/mysql/sqlfxml-producer-basic.sql"; +local $SIG{__WARN__} = sub { + CORE::warn(@_) + unless $_[0] =~ m#XML/Writer#; +}; # Testing 1,2,3,4... #=============================================================================