From: Mark Addison Date: Fri, 17 Oct 2003 13:58:39 +0000 (+0000) Subject: Added missing test for attrib_values=>1. X-Git-Tag: v0.04~54 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=f11724adcf204af2cc9285faacefe929c874cf77;p=dbsrgits%2FSQL-Translator.git Added missing test for attrib_values=>1. More detail added to test names. --- diff --git a/t/17sqlfxml-producer.t b/t/17sqlfxml-producer.t index 0ee12e5..78dd983 100644 --- a/t/17sqlfxml-producer.t +++ b/t/17sqlfxml-producer.t @@ -33,7 +33,7 @@ if ($@ && $@ =~ m!locate Test/Differences.pm in!) { plan skip_all => "You need Test::Differences for this test."; } use Test::Differences; -plan tests => 6; +plan tests => 9; use SQL::Translator; use SQL::Translator::Producer::XML::SQLFairy; @@ -145,7 +145,7 @@ $obj = SQL::Translator->new( from => 'MySQL', to => 'XML-SQLFairy', ); -lives_ok { $xml = $obj->translate($file); } "Translate ran"; +lives_ok {$xml = $obj->translate($file);} "Translate (emit_empty_tags=>0) ran"; ok("$xml" ne "" ,"Produced something!"); print "XML:\n$xml" if DEBUG; # Strip sqlf header with its variable date so we diff safely @@ -263,23 +263,52 @@ $obj = SQL::Translator->new( to => 'XML-SQLFairy', producer_args => { emit_empty_tags => 1 }, ); -lives_ok { $xml = $obj->translate($file); } "Translate ran"; +lives_ok { $xml=$obj->translate($file); } "Translate (emit_empty_tags=>1) ran"; ok("$xml" ne "" ,"Produced something!"); print "XML emit_empty_tags=>1:\n$xml" if DEBUG; # Strip sqlf header with its variable date so we diff safely $xml =~ s/^([^\n]*\n){7}//m; eq_or_diff $xml, $ans ,"XML looks right"; - # This diff probably isn't a very good test! Should really check the - # result with XPath or something, but that would take ages to write ;-) -# TODO Make this a real test of attrib_values -# $obj = SQL::Translator->new( -# debug => DEBUG, -# trace => TRACE, -# show_warnings => 1, -# add_drop_table => 1, -# from => "MySQL", -# to => "XML-SQLFairy", -# producer_args => { attrib_values => 1 }, -# ); -# print $obj->translate($file); + + +# +# attrib_values => 1 +# + +$ans = < + + + + + + + + + + + + + + + + +EOXML + +$obj = SQL::Translator->new( + debug => DEBUG, + trace => TRACE, + show_warnings => 1, + add_drop_table => 1, + from => "MySQL", + to => "XML-SQLFairy", + producer_args => { attrib_values => 1 }, +); +lives_ok {$xml = $obj->translate($file);} "Translate (attrib_values=>1) ran"; +ok("$xml" ne "" ,"Produced something!"); +print "XML attrib_values=>1:\n$xml" if DEBUG; +# Strip sqlf header with its variable date so we diff safely +$xml =~ s/^([^\n]*\n){7}//m; +eq_or_diff $xml, $ans ,"XML looks right"; +