t/xe04_escape_slash.t
raw| 1 | use strict; |
| 2 | use Test::More; |
| 3 | BEGIN { plan tests => 3 }; |
| 4 | |
| 5 | BEGIN { $ENV{PERL_JSON_BACKEND} ||= 1; } |
| 6 | |
| 7 | use JSON -support_by_pp; |
| 8 | |
| 9 | SKIP: { |
| 10 | skip "can't use JSON::XS.", 3, unless( JSON->backend->is_xs ); |
| 11 | |
| 12 | my $json = new JSON; |
| 13 | |
| 14 | |
| 15 | is($json->escape_slash(0)->allow_nonref->encode("/"), '"/"'); |
| 16 | is($json->escape_slash(1)->allow_nonref->encode("/"), '"\/"'); |
| 17 | is($json->escape_slash(0)->allow_nonref->encode("/"), '"/"'); |
| 18 | |
| 19 | |
| 20 | } |
| 21 | __END__ |
| 22 |