r8274 - in /branches/upstream/libjson-any-perl/current: Changes META.yml lib/JSON/Any.pm t/02-JSON-XS.t

eloy at users.alioth.debian.org eloy at users.alioth.debian.org
Mon Oct 15 15:05:59 UTC 2007


Author: eloy
Date: Mon Oct 15 15:05:59 2007
New Revision: 8274

URL: http://svn.debian.org/wsvn/?sc=1&rev=8274
Log:
[svn-upgrade] Integrating new upstream version, libjson-any-perl (1.10)

Modified:
    branches/upstream/libjson-any-perl/current/Changes
    branches/upstream/libjson-any-perl/current/META.yml
    branches/upstream/libjson-any-perl/current/lib/JSON/Any.pm
    branches/upstream/libjson-any-perl/current/t/02-JSON-XS.t

Modified: branches/upstream/libjson-any-perl/current/Changes
URL: http://svn.debian.org/wsvn/branches/upstream/libjson-any-perl/current/Changes?rev=8274&op=diff
==============================================================================
--- branches/upstream/libjson-any-perl/current/Changes (original)
+++ branches/upstream/libjson-any-perl/current/Changes Mon Oct 15 15:05:59 2007
@@ -1,6 +1,9 @@
 Revision history for JSON-Any
 
-1.09	???
+1.10	12 Oct 2007
+        o fix issues from http://rt.cpan.org/Public/Bug/Display.html?id=29917
+
+1.09	10 Oct 2007
         o also test for is_utf8() - nothingmuch
         o improve unicode test	- nothingmuch
         o add utf8 support for JSON::{Converter,Parser}	- nothingmuch

Modified: branches/upstream/libjson-any-perl/current/META.yml
URL: http://svn.debian.org/wsvn/branches/upstream/libjson-any-perl/current/META.yml?rev=8274&op=diff
==============================================================================
--- branches/upstream/libjson-any-perl/current/META.yml (original)
+++ branches/upstream/libjson-any-perl/current/META.yml Mon Oct 15 15:05:59 2007
@@ -17,4 +17,4 @@
     - t
 requires: 
   Carp: 0
-version: 1.09
+version: 1.10

Modified: branches/upstream/libjson-any-perl/current/lib/JSON/Any.pm
URL: http://svn.debian.org/wsvn/branches/upstream/libjson-any-perl/current/lib/JSON/Any.pm?rev=8274&op=diff
==============================================================================
--- branches/upstream/libjson-any-perl/current/lib/JSON/Any.pm (original)
+++ branches/upstream/libjson-any-perl/current/lib/JSON/Any.pm Mon Oct 15 15:05:59 2007
@@ -1,6 +1,6 @@
 ##############################################################################
 # JSON::Any
-# v1.09
+# v1.10
 # Copyright (c) 2007 Chris Thompson
 ##############################################################################
 
@@ -16,11 +16,11 @@
 
 =head1 VERSION
 
-Version 1.09
-
-=cut
-
-our $VERSION = '1.09';
+Version 1.10
+
+=cut
+
+our $VERSION = '1.10';
 
 our $UTF8;
 
@@ -90,17 +90,15 @@
                   max_depth
                 );
 
+                local $conf->{utf8} = !$conf->{utf8}; # it means the opposite
+
                 my $obj = $handler->new;
                 for my $mutator (@params) {
                     next unless exists $conf->{$mutator};
                     $obj = $obj->$mutator( $conf->{$mutator} );
                 }
                 $self->[ENCODER] = 'encode';
-                $self->[DECODER] = sub {
-                    my ( $handler, $json ) = @_;
-                    utf8::encode($json) if utf8::is_utf8($json);
-                    $handler->decode($json);
-                };
+                $self->[DECODER] = 'decode';
                 $self->[HANDLER] = $obj;
             },
         },

Modified: branches/upstream/libjson-any-perl/current/t/02-JSON-XS.t
URL: http://svn.debian.org/wsvn/branches/upstream/libjson-any-perl/current/t/02-JSON-XS.t?rev=8274&op=diff
==============================================================================
--- branches/upstream/libjson-any-perl/current/t/02-JSON-XS.t (original)
+++ branches/upstream/libjson-any-perl/current/t/02-JSON-XS.t Mon Oct 15 15:05:59 2007
@@ -1,4 +1,6 @@
 #!perl -T
+
+use utf8;
 use strict;
 use Test::More;
 
@@ -7,7 +9,7 @@
     plan skip_all => "JSON::XS not installed: $@";
 }
 else {
-    plan tests => 10;
+    plan tests => 20;
 }
 
 skip "JSON::XS not installed: $@", 1 if $@;
@@ -16,8 +18,23 @@
 is( JSON::Any->encode({foo=>'bar'}), qq[{"foo":"bar"}] );
 
 my ( $json, $js, $obj );
-ok( $json = JSON::Any->new( allow_nonref => 1 ) );
+ok( $json = JSON::Any->new( allow_nonref => 1, utf8 => 1 ) );
 is( $json->encode("ü"), qq["ü"] );
+
+foreach my $bytes ( 0, 1 ) {
+    foreach my $utf8_support ( 0, 1 ) {
+        my $str = "ü";
+        utf8::encode($str) if $bytes;
+        ok( $json = JSON::Any->new( allow_nonref => 1, utf8 => $utf8_support ) );
+
+        if ( $utf8_support ) { # only then do we make assumptions about the output json
+            is( $json->encode($str), qq["$str"] );
+        }
+
+        is( $json->decode($json->encode($str)), $str, "round tripping" );
+    }
+}
+
 ok( $json = JSON::Any->new( allow_nonref => 1, ascii => 1, utf8 => 1 ) );
 is( $json->encode( chr 0x8000 ), '"\u8000"' );
 ok(
@@ -31,11 +48,7 @@
 is( $json->encode( chr 0x10402 ), '"\ud801\udc02"' );
 ok( $json = JSON::Any->new( allow_nonref => 1, utf8 => 1 ) );
 
-TODO: {
-
-    local $TODO = 'figure out why ü ne qq["\xc3\xbc\"]';
-    is( $json->encode("ü"), qq["\xc3\xbc\"] );
-}
+is( $json->encode("ü"), qq["\xc3\xbc\"] );
 
 is( JSON::Any->encode({foo=>'bar'}), qq[{"foo":"bar"}] );
 




More information about the Pkg-perl-cvs-commits mailing list