Skip Menu |

This queue is for tickets about the SQL-Translator CPAN distribution.

Report information
The Basics
Id: 98824
Status: resolved
Priority: 0/
Queue: SQL-Translator

People
Owner: Nobody in particular
Requestors: HMBRAND [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in: 0.11020
Fixed in: 0.11021



Subject: [PATCH] Some idiots changed the default behavior of JSON formatters
--- t/23json.t.org 2014-09-12 08:45:33.401268362 +0200 It is *NOT* the responsibility of SQL::Translator to verify the style/layout/formatting of JSON All it needs to know it that the *content* is valid +++ t/23json.t 2014-09-12 08:46:32.040973724 +0200 @@ -301,4 +301,12 @@ my $tr = SQL::Translator->new( my $out; ok( $out = $tr->translate, 'Translate SQLite to JSON' ); +# Some idiots modify the default format of JSON +# while it is still valid JSON, it is not the default +for ($out, $json) { + s/ +/ /g; + s/^ +//mg; + s/\[ ]/[]/g; + s/[{] }/{}/g; +} eq_or_diff( $out, $json, 'JSON matches expected' );
A cleaner patch: --- t/23json.t 2014-05-30 10:30:36.676381388 +0200 +++ t/23json.t 2014-05-30 10:34:01.171957481 +0200 @@ -301,4 +301,9 @@ my $tr = SQL::Translator->new( my $out; ok( $out = $tr->translate, 'Translate SQLite to JSON' ); +for ($out, $json) { + s/^\s+//gm; + s/\[\s+\]/[]/gm; + s/\{\s+\}/{}/gm; + } eq_or_diff( $out, $json, 'JSON matches expected' );
Git now contains an alternative fix to this problem, by round-tripping the expected JSON, to format it consistently. https://github.com/dbsrgits/sql-translator/commit/4f2693e35733b682fc641220bb8896f8041f2757