From: Darren Chamberlain Date: Tue, 6 May 2003 12:45:49 +0000 (+0000) Subject: Updated XML test. X-Git-Tag: v0.02~141 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=5dada97b31f2dd7099fa37f2c8184ad59aa38088;p=dbsrgits%2FSQL-Translator.git Updated XML test. --- diff --git a/t/01load.t b/t/01load.t index e6378aa..64e14ac 100644 --- a/t/01load.t +++ b/t/01load.t @@ -25,11 +25,10 @@ while () { close MANIFH; -@perlmods = sort { length $a <=> length $b } @perlmods; # aesthetics +@perlmods = sort @perlmods; # aesthetics plan tests => scalar @perlmods; for my $mod (@perlmods) { - SQL::Translator::load($mod); - ok(!$@, "use $mod"); + use_ok($mod); } diff --git a/t/05bgep-re.t b/t/05bgep-re.t index 8efb0d6..75e9516 100644 --- a/t/05bgep-re.t +++ b/t/05bgep-re.t @@ -2,25 +2,42 @@ # vim: set ft=perl: # -BEGIN { print "1..1\n"; } - use strict; -use Data::Dumper; -use SQL::Translator; -use SQL::Translator::Parser::MySQL; -use SQL::Translator::Producer::XML; - -$SQL::Translator::DEBUG = 0; - -my $tr = SQL::Translator->new(parser => "MySQL", producer => "XML"); - -my $datafile = "t/data/mysql/BGEP-RE-create.sql"; -my $data; -open FH, $datafile or die "Can't open $datafile: $!"; -read(FH, $data, -s $datafile); -close FH; - - -print $tr->translate(\$data); -print "ok 1\n"; +use File::Spec::Functions qw(catfile tmpdir); +use File::Temp qw(tempfile); +use FindBin qw($Bin); +use SQL::Translator; +use Test::More tests => 2; + +my @data = qw(data mysql BGEP-RE-create.sql); +my $test_data = (-d "t") + ? catfile($Bin, @data) + : catfile($Bin, "t", @data); + +my $tr = SQL::Translator->new(parser => "MySQL", + producer => "XML", + filename => $test_data); +my $data = $tr->translate; + +ok($data, "MySQL->XML"); + +SKIP: { + eval { + require XML::Parser; + }; + if ($@) { + skip "Can't load XML::Parser" => 1; + } + + # Can't get XML::Parser::parsestring to do Useful Things + my ($fh, $fname) = tempfile('sqlfXXXX', + UNLINK => 1, + SUFFIX => '.xml', + DIR => tmpdir); + print $fh $data; + $fh->close; + + ok(XML::Parser->new->parsefile($fname), + "Successfully parsed output"); +} diff --git a/t/13schema.t b/t/13schema.t index 2025d75..aaece72 100644 --- a/t/13schema.t +++ b/t/13schema.t @@ -1,4 +1,5 @@ #!/usr/bin/perl +# vim:set ft=perl: $| = 1;