r8276 - in /trunk/libjson-any-perl: Changes META.yml debian/changelog 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:09:26 UTC 2007
Author: eloy
Date: Mon Oct 15 15:09:26 2007
New Revision: 8276
URL: http://svn.debian.org/wsvn/?sc=1&rev=8276
Log:
new upstream version
fix issues from http://rt.cpan.org/Public/Bug/Display.html?id=29917
Modified:
trunk/libjson-any-perl/Changes
trunk/libjson-any-perl/META.yml
trunk/libjson-any-perl/debian/changelog
trunk/libjson-any-perl/lib/JSON/Any.pm
trunk/libjson-any-perl/t/02-JSON-XS.t
Modified: trunk/libjson-any-perl/Changes
URL: http://svn.debian.org/wsvn/trunk/libjson-any-perl/Changes?rev=8276&op=diff
==============================================================================
--- trunk/libjson-any-perl/Changes (original)
+++ trunk/libjson-any-perl/Changes Mon Oct 15 15:09:26 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: trunk/libjson-any-perl/META.yml
URL: http://svn.debian.org/wsvn/trunk/libjson-any-perl/META.yml?rev=8276&op=diff
==============================================================================
--- trunk/libjson-any-perl/META.yml (original)
+++ trunk/libjson-any-perl/META.yml Mon Oct 15 15:09:26 2007
@@ -17,4 +17,4 @@
- t
requires:
Carp: 0
-version: 1.09
+version: 1.10
Modified: trunk/libjson-any-perl/debian/changelog
URL: http://svn.debian.org/wsvn/trunk/libjson-any-perl/debian/changelog?rev=8276&op=diff
==============================================================================
--- trunk/libjson-any-perl/debian/changelog (original)
+++ trunk/libjson-any-perl/debian/changelog Mon Oct 15 15:09:26 2007
@@ -1,3 +1,10 @@
+libjson-any-perl (1.10-1) unstable; urgency=low
+
+ * New upstream release
+ Fix issues from http://rt.cpan.org/Public/Bug/Display.html?id=29917
+
+ -- Krzysztof Krzyzaniak (eloy) <eloy at debian.org> Mon, 15 Oct 2007 17:06:18 +0200
+
libjson-any-perl (1.09-1) unstable; urgency=low
* New upstream release
Modified: trunk/libjson-any-perl/lib/JSON/Any.pm
URL: http://svn.debian.org/wsvn/trunk/libjson-any-perl/lib/JSON/Any.pm?rev=8276&op=diff
==============================================================================
--- trunk/libjson-any-perl/lib/JSON/Any.pm (original)
+++ trunk/libjson-any-perl/lib/JSON/Any.pm Mon Oct 15 15:09:26 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: trunk/libjson-any-perl/t/02-JSON-XS.t
URL: http://svn.debian.org/wsvn/trunk/libjson-any-perl/t/02-JSON-XS.t?rev=8276&op=diff
==============================================================================
--- trunk/libjson-any-perl/t/02-JSON-XS.t (original)
+++ trunk/libjson-any-perl/t/02-JSON-XS.t Mon Oct 15 15:09:26 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