Permalink
Browse files

fix bug #30509

  • Loading branch information...
1 parent 6f5cb89 commit b7333f2ba759346ebcadd1478b9ad7ef9820812a perigrin committed Nov 7, 2007
Showing with 24 additions and 13 deletions.
  1. +3 −0 Changes
  2. +21 −13 t/10_unicode.t
View
@@ -1,4 +1,7 @@
Revision history for JSON-Any
+1.13 2007-11-06
+ * Fix 10_unicode.t to skip_all if no supported unicode backend is found
+ (reported by Andreas König)
1.12 2007-10-22
* Fix issue with 05-JSON-Syck.t so we can pass our tests again
View
@@ -2,7 +2,7 @@
$|++;
use strict;
use utf8;
-use Test::More 'no_plan';
+use Test::More;
use JSON::Any;
@@ -14,20 +14,24 @@ foreach my $backend qw(XS JSON DWIW Syck PC) {
JSON::Any->new;
};
- diag $@ and next if $@;
+ diag "$backend: " . $@ and next if $@;
$j and $j->handler or next;
- diag "handler is " . (ref($j->handler) || $j->handlerType);
+ diag "handler is " . ( ref( $j->handler ) || $j->handlerType );
+
+ plan 'no_plan' unless $ENV{JSON_ANY_RAN_TESTS};
+ $ENV{JSON_ANY_RAN_TESTS} = 1;
foreach my $text qw(foo שלום) {
- my $struct = [ $text ];
+ my $struct = [$text];
- my $frozen = $j->encode( $struct );
- my $thawed = $j->decode( $frozen );
+ my $frozen = $j->encode($struct);
+ my $thawed = $j->decode($frozen);
- ok( utf8::is_utf8($frozen) || !scalar($frozen !~ /[\w\d[:punct:]]/), "json output is utf8");
+ ok( utf8::is_utf8($frozen) || !scalar( $frozen !~ /[\w\d[:punct:]]/ ),
+ "json output is utf8" );
is_deeply( $thawed, $struct, "deeply" );
@@ -36,15 +40,16 @@ foreach my $backend qw(XS JSON DWIW Syck PC) {
my $d = Devel::StringInfo->new;
$d->dump_info( $text, name => "expected" );
$d->dump_info( $thawed->[0], name => "got" );
- $d->dump_info( $frozen );
+ $d->dump_info($frozen);
};
- ok( utf8::is_utf8($thawed->[0]) || !scalar($text !~ /[a-z]/), "text is utf8 if it needs to be" );
+ ok( utf8::is_utf8( $thawed->[0] ) || !scalar( $text !~ /[a-z]/ ),
+ "text is utf8 if it needs to be" );
- if ( utf8::valid($frozen) ) {
+ if ( utf8::valid($frozen) ) {
utf8::decode($frozen);
- my $thawed = $j->decode( $frozen );
+ my $thawed = $j->decode($frozen);
is_deeply( $thawed, $struct, "deeply" );
@@ -53,11 +58,14 @@ foreach my $backend qw(XS JSON DWIW Syck PC) {
my $d = Devel::StringInfo->new;
$d->dump_info( $text, name => "expected" );
$d->dump_info( $thawed->[0], name => "got" );
- $d->dump_info( $frozen );
+ $d->dump_info($frozen);
};
- ok( utf8::is_utf8($thawed->[0]) || !scalar($text !~ /[a-z]/), "text is utf8 if it needs to be" );
+ ok( utf8::is_utf8( $thawed->[0] ) || !scalar( $text !~ /[a-z]/ ),
+ "text is utf8 if it needs to be" );
}
}
}
+plan skip_all => 'no JSON package with unicode support installed'
+ unless $ENV{JSON_ANY_RAN_TESTS};

0 comments on commit b7333f2

Please sign in to comment.