From: Peter Rabbitson Date: Wed, 18 Jan 2012 07:34:28 +0000 (+0100) Subject: Fix spurious whitespace failures in t/17sqlfxml-producer.t (RT#70786) X-Git-Tag: v0.11011~38 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=715b82950282ae3475e24d9b5c407d8d112399dc;p=dbsrgits%2FSQL-Translator.git Fix spurious whitespace failures in t/17sqlfxml-producer.t (RT#70786) --- diff --git a/AUTHORS b/AUTHORS index d0138ae..ec6fc89 100644 --- a/AUTHORS +++ b/AUTHORS @@ -34,6 +34,7 @@ The following people have contributed to the SQLFairy project: - Lukas Thiemeier - Mark Addison - Maximilian Gass +- H.Merijn Brand - Michal Jurosz - Mikey Melillo - Moritz Onken diff --git a/Changes b/Changes index a9d37ea..e869539 100644 --- a/Changes +++ b/Changes @@ -30,6 +30,8 @@ * Fix Diagram Producer POD (RT#71397, RT#71398) * Fix Diagram Producer to use correct binmode on output (RT#71399) * Fix ignored option to script/sqlt-diagram (RT#5992) +* Fix t/17sqlfxml-producer.t failures due to whitespace differences introduced by + environment config snippets (RT#70786) # ---------------------------------------------------------- # 0.11010 2011-10-05 diff --git a/t/17sqlfxml-producer.t b/t/17sqlfxml-producer.t index d9d0868..cded24b 100644 --- a/t/17sqlfxml-producer.t +++ b/t/17sqlfxml-producer.t @@ -40,6 +40,17 @@ use Test::Differences; use SQL::Translator; use SQL::Translator::Producer::XML::SQLFairy; +# Due to formatters being able to change style, e.g. by entries in .rc files +# in $HOME, the layout and or indent might differ slightly. As leading white +# is not important in XML, strip it when comparing +sub xml_equals +{ + my ($got, $expect, $msg) = (@_, "XML looks right"); + $got =~ s/^ +//gm; + $expect =~ s/^ +//gm; + eq_or_diff $got, $expect, $msg; +} + # # basic stuff # @@ -105,7 +116,7 @@ ok("$xml" ne "" ,"Produced something!"); print "XML:\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"; +xml_equals $xml, $ans; } # end basic stuff @@ -158,7 +169,7 @@ EOXML 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"; + xml_equals $xml, $ans; } # end View # @@ -221,7 +232,7 @@ EOXML 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"; + xml_equals $xml, $ans; } # end Trigger # @@ -277,7 +288,7 @@ EOXML 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"; + xml_equals $xml, $ans; } # end Procedure # @@ -353,5 +364,5 @@ EOXML print "XML:\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"; + xml_equals $xml, $ans; } # end extra