Skip to content

Commit

Permalink
added dualvar test
Browse files Browse the repository at this point in the history
  • Loading branch information
kraih committed May 12, 2014
1 parent 6ed79b5 commit 79396d7
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions t/mojo/json.t
Expand Up @@ -12,6 +12,7 @@ use Test::More;
use Mojo::ByteStream 'b';
use Mojo::JSON qw(decode_json encode_json j);
use Mojo::Util 'encode';
use Scalar::Util 'dualvar';

# Decode array
my $array = decode_json '[]';
Expand Down Expand Up @@ -301,6 +302,10 @@ $str = "bar";
is encode_json({test => [$num, $str]}), '{"test":[23,"bar"]}',
'upgraded string detected';

# dualvar
my $dual = dualvar 23, 'twenty three';
is encode_json([$dual]), '["twenty three"]', 'dualvar stringified';

# Ensure numbers and strings are not upgraded
my $mixed = [3, 'three', '3', 0, "0"];
is encode_json($mixed), '[3,"three","3",0,"0"]',
Expand Down

0 comments on commit 79396d7

Please sign in to comment.