From: Jess Robinson Date: Thu, 9 Nov 2006 18:22:22 +0000 (+0000) Subject: Fixed tests for mysql producer changes X-Git-Tag: v0.11008~396 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=f6af58ae23517dea4bc03004527ce1496e6ce006;p=dbsrgits%2FSQL-Translator.git Fixed tests for mysql producer changes --- diff --git a/t/38-mysql-producer.t b/t/38-mysql-producer.t index fe06a96..798701e 100644 --- a/t/38-mysql-producer.t +++ b/t/38-mysql-producer.t @@ -19,7 +19,7 @@ use FindBin qw/$Bin/; #============================================================================= BEGIN { - maybe_plan(7, + maybe_plan(11, 'YAML', 'SQL::Translator::Producer::MySQL', 'Test::Differences', @@ -100,10 +100,11 @@ schema: EOSCHEMA -my $mysql_out = <new( @@ -140,15 +147,33 @@ EOSQL my $out = $sqlt->translate(\$yaml_in) or die "Translate error:".$sqlt->error; - ok $out ne "" ,"Produced something!"; - eq_or_diff $out, $mysql_out ,"Output looks right with quoting"; + ok $out ne "", "Produced something!"; + eq_or_diff $out, $mysql_out, "Scalar output looks right with quoting"; + + my @out = $sqlt->translate(\$yaml_in) + or die "Translat eerror:".$sqlt->error; + is_deeply \@out, \@stmts_no_drop, "Array output looks right with quoting"; - @{$sqlt}{qw/quote_table_names quote_field_names/} = (0,0); + @{$sqlt}{qw/quote_table_names quote_field_names/} = (0,0); $out = $sqlt->translate(\$yaml_in) - or die "Translat eerror:".$sqlt->error; + or die "Translat eerror:".$sqlt->error; + + @out = $sqlt->translate(\$yaml_in) + or die "Translat eerror:".$sqlt->error; $mysql_out =~ s/`//g; - eq_or_diff $out, $mysql_out, "Output looks right without quoting"; + my @unquoted_stmts = map { s/`//g; $_} @stmts_no_drop; + eq_or_diff $out, $mysql_out, "Output looks right without quoting"; + is_deeply \@out, \@unquoted_stmts, "Array output looks right without quoting"; + + @{$sqlt}{qw/add_drop_table quote_field_names quote_table_names/} = (1,1,1); + @out = $sqlt->translate(\$yaml_in) + or die "Translat eerror:".$sqlt->error; + $out = $sqlt->translate(\$yaml_in) + or die "Translat eerror:".$sqlt->error; + + eq_or_diff $out, join("", @stmts), "Output looks right with DROP TABLEs"; + is_deeply \@out, \@stmts, "Array output looks right with DROP TABLEs"; } ###############################################################################