X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2F60roundtrip.t;h=0d72805f57a4c22101fd6b72d41fecaf9d2d8737;hb=4f3b7c4e95ac9a477a0a6131e5c8c1671a0cafc4;hp=d9a6d67e59642f17051955ac7805a596f1d8063d;hpb=e4b196dbe2b08fa1679dc61bc81b89927af40003;p=dbsrgits%2FSQL-Translator-2.0-ish.git diff --git a/t/60roundtrip.t b/t/60roundtrip.t index d9a6d67..0d72805 100644 --- a/t/60roundtrip.t +++ b/t/60roundtrip.t @@ -90,7 +90,7 @@ $base_t->$_ (1) for qw/add_drop_table no_comments/; my $base_schema = $base_t->translate( parser => 'YAML', data => do { local $/; <$base_fh>; }, -) or die $base_t->error; +) or die $!; #assume there is at least one table my $string_re = { @@ -120,7 +120,7 @@ for my $args (@$plan) { local $TODO = $args->{todo} if $args->{todo}; lives_ok ( - sub { check_roundtrip ($args, $base_t, $base_schema) }, + sub { check_roundtrip ($args, $base_t) }, "Round trip for $args->{name} did not throw an exception", ); } @@ -129,14 +129,14 @@ for my $args (@$plan) { done_testing; sub check_roundtrip { - my ($args, $base_t, $base_schema) = @_; + my ($args, $base_t) = @_; # create some output from the submitted schema my $base_out = $base_t->translate( - data => $base_schema, + data => $base_t->schema, producer => $args->{engine}, -# producer_args => $args->{producer_args}, + producer_args => $args->{producer_args} || {}, ); like ( @@ -144,7 +144,7 @@ sub check_roundtrip { $string_re->{$args->{engine}} || $string_re->{SQL}, "Received some meaningful output from the first $args->{name} production", ) or do { - diag ( _gen_diag ($base_t->error) ); + diag ( _gen_diag ($@) ); return; }; @@ -154,12 +154,12 @@ sub check_roundtrip { my $mid_schema = $parser_t->translate ( data => $base_out, parser => $args->{engine}, -# parser_args => $args->{parser_args}, + parser_args => $args->{parser_args} || {}, ); isa_ok ($mid_schema, 'SQL::Translator::Object::Schema', "First $args->{name} parser pass produced a schema:") or do { - diag (_gen_diag ( $parser_t->error, $base_out ) ); + diag (_gen_diag ( $@, $base_out ) ); return; }; @@ -186,7 +186,7 @@ sub check_roundtrip { my $rt_out = $parser_t->translate ( data => $mid_schema, producer => $args->{engine}, -# producer_args => $args->{producer_args}, + producer_args => $args->{producer_args} || {}, ); like ( @@ -194,7 +194,7 @@ sub check_roundtrip { $string_re->{$args->{engine}} || $string_re->{SQL}, "Received some meaningful output from the second $args->{name} production", ) or do { - diag ( _gen_diag ( $parser_t->error ) ); + diag ( _gen_diag ( $@ ) ); return; };