1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41
|
#! /usr/bin/env perl
use strict;
use warnings FATAL => 'all';
use utf8;
use Test::More tests => 6;
use_ok('Data::DPath::Path');
my $FIXTURES = [
{
name => 'double quote',
string => '\\"',
result => '"',
},
{
name => 'backslash',
string => '\\\\',
result => '\\',
},
{
name => 'backslash with double quote',
string => '\\\\\\"',
result => '\\"',
},
{
name => 'two backslash with double quote',
string => '\\\\\\\\\\"',
result => '\\\\"',
},
{
name => 'example from documentations',
string => '\"EE\E5\\\\\\"',
result => '"EE\E5\"',
},
];
foreach my $test (@$FIXTURES) {
is(Data::DPath::Path::unescape($test->{'string'}), $test->{'result'}, $test->{'name'});
}
|