Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

[svn:dbi] r15588 - dbi/trunk/t

1 view
Skip to first unread message

hmb...@cvs.perl.org

unread,
Mar 25, 2013, 1:37:28 PM3/25/13
to svn-commit-...@perl.org
Author: hmbrand
Date: Mon Mar 25 10:37:27 2013
New Revision: 15588

Modified:
dbi/trunk/t/90sql_type_cast.t

Log:
Ignore space issues of JSON formatting

The tests are about quotation of the value. Strip all leading/trailing
whitespace that is not part of the test, treating '[99]' identical to
' [ 99 ] ' or '[99 ]'

reason is that the layout is not part of the test, and formatters are
free to add/remove leading/trailing whitespace

These tests are only run if JSON::XS is installed.

Modified: dbi/trunk/t/90sql_type_cast.t
==============================================================================
--- dbi/trunk/t/90sql_type_cast.t (original)
+++ dbi/trunk/t/90sql_type_cast.t Mon Mar 25 10:37:27 2013
@@ -118,6 +118,11 @@

my $json = JSON::XS->new->encode([$val]);
#diag(neat($val), ",", $json);
+ # This test is about quotation of the value, not about the
+ # style/formatting of JSON. Strip all leading/trailing
+ # whitespace that is not part of the test, treating '[99]'
+ # identical to ' [ 99 ] ' or '[99 ]'
+ $json =~ s{^\s*\[\s*(.*?)\s*\]\s*$}{[$1]};
is($json, $test->[5], "json $test->[0]");
};
}
0 new messages