use Test::More;
use SQL::Translator;
use SQL::Translator::Schema::Constants;
+use Test::SQL::Translator qw(maybe_plan);
-eval {
- require SQL::Translator::Parser::MySQL;
+BEGIN {
+ maybe_plan(180, "SQL::Translator::Parser::MySQL");
SQL::Translator::Parser::MySQL->import('parse');
-};
-if ($@) {
- plan skip_all => "$@";
-}
-else {
- plan tests => 180;
}
{
# vim: set ft=perl:
use strict;
-use Test::More tests => 1;
+use Test::More;
use SQL::Translator;
+use Test::SQL::Translator qw(maybe_plan);
my $create = q|
CREATE TABLE random (
);
|;
+BEGIN {
+ maybe_plan(1,
+ 'SQL::Translator::Parser::MySQL',
+ 'SQL::Translator::Producer::Oracle');
+}
+
my $tr = SQL::Translator->new(
parser => "MySQL",
producer => "Oracle"
use SQL::Translator;
use Test::More tests => 3;
-
# The filename, holder for all the data, and the filehandle
my $datafile = "t/data/mysql/Apache-Session-MySQL.sql";
my $data;
use File::Temp qw(tempfile);
use FindBin qw($Bin);
use SQL::Translator;
-use Test::More tests => 2;
+use Test::More;
+use Test::SQL::Translator qw(maybe_plan);
# This aggravates me; XML::Writer produces tons of warnings.
local $SIG{__WARN__} = sub {
unless $_[0] =~ m#XML/Writer#;
};
+BEGIN {
+ maybe_plan(2,
+ 'SQL::Translator::Parser::MySQL',
+ 'SQL::Translator::Producer::XML::SQLFairy');
+}
+
my @data = qw(data mysql BGEP-RE-create.sql);
my $test_data = (-d "t")
? catfile($Bin, @data)
use SQL::Translator::Schema;
use SQL::Translator::Schema::Constants;
use Test::More;
+use Test::SQL::Translator qw(maybe_plan);
-eval {
- require SQL::Translator::Parser::xSV;
+BEGIN {
+ maybe_plan(25, 'SQL::Translator::Parser::xSV');
SQL::Translator::Parser::xSV->import('parse');
-};
-if ($@) {
- plan skip_all => "$@";
-}
-else {
- plan tests => 25;
}
my $tr = SQL::Translator->new;
# vim: set ft=perl:
use strict;
-use Test::More tests => 1;
+use Test::More;
use SQL::Translator;
use Data::Dumper;
+use Test::SQL::Translator qw(maybe_plan);
+
+BEGIN {
+ maybe_plan(1,
+ 'SQL::Translator::Parser::MySQL',
+ 'SQL::Translator::Producer::PostgreSQL');
+}
my $create = q|
use File::Temp qw(mktemp);
use FindBin qw($Bin);
use Test;
+use Test::SQL::Translator qw(maybe_plan);
+
+BEGIN {
+ maybe_plan(3,
+ 'SQL::Translator::Parser::MySQL',
+ 'SQL::Translator::Producer::Diagram');
+}
my @script = qw(blib script sqlt-diagram);
my @data = qw(data mysql Apache-Session-MySQL.sql);
my $tmp = mktemp('sqlXXXXX');
-BEGIN {
- plan tests => 3;
-}
-
ok(-e $sqlt_diagram);
-eval { require GD; };
-if ($@ && $@ =~ /locate GD.pm in /) {
- skip($@, "GD not installed");
- skip($@, "GD not installed");
-} else {
- my @cmd = ($sqlt_diagram, "-d", "MySQL", "-o", $tmp, $test_data);
- eval { system(@cmd); };
- ok(!$@ && ($? == 0));
- ok(-e $tmp);
- eval { unlink $tmp; };
-}
+my @cmd = ($sqlt_diagram, "-d", "MySQL", "-o", $tmp, $test_data);
+eval { system(@cmd); };
+ok(!$@ && ($? == 0));
+ok(-e $tmp);
+eval { unlink $tmp; };
use Test::More;
use SQL::Translator;
use SQL::Translator::Schema::Constants;
+use Test::SQL::Translator qw(maybe_plan);
-eval {
- require SQL::Translator::Parser::Excel;
+BEGIN {
+ maybe_plan(31, '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;
use Test::More;
use SQL::Translator;
use SQL::Translator::Schema::Constants;
+use Test::SQL::Translator qw(maybe_plan);
-eval {
- require SQL::Translator::Parser::PostgreSQL;
+BEGIN {
+ maybe_plan(119, 'SQL::Translator::Parser::PostgreSQL');
SQL::Translator::Parser::PostgreSQL->import('parse');
-};
-if ($@) {
- plan skip_all => "$@";
-}
-else {
- plan tests => 119;
}
my $t = SQL::Translator->new( trace => 0 );
use Test::More;
use SQL::Translator;
use SQL::Translator::Schema::Constants;
+use Test::SQL::Translator qw(maybe_plan);
-eval {
- require SQL::Translator::Parser::Oracle;
- SQL::Translator::Parser::Oracle->import('parse');
-};
-if ($@) {
- plan skip_all => "$@";
-}
-else {
- plan tests => 76;
-}
+maybe_plan(76, 'SQL::Translator::Parser::Oracle');
+SQL::Translator::Parser::Oracle->import('parse');
my $t = SQL::Translator->new( trace => 0 );
my $sql = q[
# Testing 1,2,3,4...
#=============================================================================
-
-plan tests => 284;
+
+BEGIN {
+ maybe_plan(284, 'SQL::Translator::Parser::XML::SQLFairy');
+}
foreach (
"$Bin/data/xml/schema-basic.xml",
use strict;
use Test::More;
use Test::Exception;
+use Test::SQL::Translator qw(maybe_plan);
use Data::Dumper;
my %opt;
# Testing 1,2,3,4...
#=============================================================================
-eval { require XML::Writer; };
-if ($@ && $@ =~ m!locate XML::Writer.pm in!) {
- plan skip_all => "You need XML::Writer to use XML::SQLFairy.";
+BEGIN {
+ maybe_plan(18,
+ 'XML::Writer',
+ 'Test::Differences',
+ 'SQL::Translator::Producer::XML::SQLFairy');
}
-eval { require Test::Differences; };
-if ($@ && $@ =~ m!locate Test/Differences.pm in!) {
- plan skip_all => "You need Test::Differences for this test.";
-}
-use Test::Differences;
-plan tests => 18;
+use Test::Differences;
use SQL::Translator;
use SQL::Translator::Producer::XML::SQLFairy;
use strict;
use Test::More;
use Test::Exception;
+use Test::SQL::Translator qw(maybe_plan);
use Data::Dumper;
use vars '%opt';
# Testing 1,2,3,4...
#=============================================================================
-eval { require Template; };
-if ($@ && $@ =~ m!locate Template.pm in!) {
- plan skip_all => "You need Template Toolkit to run this test.";
-}
-eval { require Test::Differences; };
-if ($@ && $@ =~ m!locate Test/Differences.pm in!) {
- plan skip_all => "You need Test::Differences for this test.";
+BEGIN {
+ maybe_plan(3, 'Template', 'Test::Differences')
}
use Test::Differences;
-plan tests => 3;
use SQL::Translator;
use SQL::Translator::Producer::TTSchema;
use strict;
use FindBin qw/$Bin/;
-use Test::More tests => 41;
+use Test::More;
+use Test::SQL::Translator qw(maybe_plan);
use SQL::Translator;
use SQL::Translator::Schema::Constants;
-use SQL::Translator::Parser::Sybase qw(parse);
+
+BEGIN {
+ maybe_plan(41, 'SQL::Translator::Parser::Sybase');
+ SQL::Translator::Parser::Sybase->import('parse');
+}
my $file = "$Bin/data/sybase/create.sql";
use Test::More;
use Test::Exception;
+use Test::SQL::Translator qw(maybe_plan);
use SQL::Translator;
use SQL::Translator::Schema::Constants;
# Testing 1,2,3,..
#=============================================================================
-plan tests => 103;
+maybe_plan(103,
+ 'SQL::Translator::Parser::XML::XMI',
+ 'SQL::Translator::Producer::MySQL');
my $testschema = "$Bin/data/xmi/Foo.poseidon2.xmi";
die "Can't find test schema $testschema" unless -e $testschema;
use Test::More;
use Test::Exception;
+use Test::SQL::Translator qw(maybe_plan);
use SQL::Translator;
use SQL::Translator::Schema::Constants;
-plan tests => 8;
+maybe_plan(8,
+ 'SQL::Translator::Parser::XML::XMI',
+ 'SQL::Translator::Producer::MySQL');
my $testschema = "$Bin/data/xmi/Foo.poseidon2.xmi";
die "Can't find test schema $testschema" unless -e $testschema;
use Test::More;
use Test::Exception;
+use Test::SQL::Translator qw(maybe_plan);
use SQL::Translator;
use SQL::Translator::Schema::Constants;
+BEGIN {
+ maybe_plan(92,
+ 'SQL::Translator::Parser::XML::XMI::Rational',
+ 'SQL::Translator::Producer::MySQL');
+}
+
# Usefull test subs for the schema objs
#=============================================================================
# Testing 1,2,3,..
#=============================================================================
-plan tests => 92;
-
my $testschema = "$Bin/data/xmi/OrderDB.rationalprofile.poseidon2.xmi";
die "Can't find test schema $testschema" unless -e $testschema;
# vim: set ft=perl:
use strict;
-use Test::More tests => 2;
+use Test::More;
use Test::Differences;
+use Test::SQL::Translator qw(maybe_plan);
use SQL::Translator;
use FindBin '$Bin';
+BEGIN {
+ maybe_plan(2,
+ 'SQL::Translator::Parser::SQLite',
+ 'SQL::Translator::Producer::YAML');
+}
+
my $yaml = q/--- #YAML:1.0
schema:
procedures: {}
# vim: set ft=perl:
use strict;
-use Test::More tests => 5;
+use Test::More;
+use Test::SQL::Translator qw(maybe_plan);
use FindBin qw/$Bin/;
use SQL::Translator;
-use SQL::Translator::Parser::SQLite 'parse';
use SQL::Translator::Schema::Constants;
+BEGIN {
+ maybe_plan(5,
+ 'SQL::Translator::Parser::SQLite');
+}
+SQL::Translator::Parser::SQLite->import('parse');
+
my $file = "$Bin/data/sqlite/create.sql";
{
# Testing 1,2,3,..
#=============================================================================
-plan tests => 321;
+BEGIN {
+ maybe_plan(321,
+ 'SQL::Translator::Parser::XML::XMI::SQLFairy',
+ 'SQL::Translator::Producer::MySQL');
+}
my $testschema = "$Bin/data/xmi/OrderDB.sqlfairy.poseidon2.xmi";
die "Can't find test schema $testschema" unless -e $testschema;
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,
$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");
use File::Spec::Functions qw(catfile updir tmpdir);
use FindBin qw($Bin);
use Test::More;
+use Test::SQL::Translator qw(maybe_plan);
my @script = qw(blib script sqlt-diff);
my @create1 = qw(data sqlite create.sql);
? catfile($Bin, @create2)
: catfile($Bin, "t", @create2);
-plan tests => 3;
+BEGIN {
+ maybe_plan(3,
+ 'SQL::Translator::Parser::SQLite',
+ 'SQL::Translator::Producer::YAML',
+ );
+}
ok(-e $sqlt_diff, 'Found sqlt-diff script');
my @cmd = ($sqlt_diff, "$create1=SQLite", "$create2=SQLite");