X-Git-Url: http://git.vpit.fr/?a=blobdiff_plain;f=t%2F21-commas.t;fp=t%2F21-commas.t;h=1cdd0d0c59214c108c804193b79e6436d6d66ddb;hb=fbd767d1d92b735a6509e57ccfbd73b45845081e;hp=0000000000000000000000000000000000000000;hpb=5468cc9fedae639e785117ab38807d857c84bdec;p=perl%2Fmodules%2FRegexp-Wildcards.git diff --git a/t/21-commas.t b/t/21-commas.t new file mode 100644 index 0000000..1cdd0d0 --- /dev/null +++ b/t/21-commas.t @@ -0,0 +1,26 @@ +#!perl -T + +use strict; +use warnings; + +use Test::More tests => 8; + +use Regexp::Wildcards; + +my $rw = Regexp::Wildcards->new(); # unix + +is($rw->convert('a,b,c'), 'a\\,b\\,c', 'unix: commas outside of brackets 1'); +is($rw->convert('a\\,b\\\\\\,c'), 'a\\,b\\\\\\,c', + 'unix: commas outside of brackets 2'); +is($rw->convert(',a,b,c\\\\,'), '\\,a\\,b\\,c\\\\\\,', + 'unix: commas outside of brackets at begin/ed'); + +$rw = Regexp::Wildcards->new(type => 'commas'); + +is($rw->convert('a,b\\\\,c'), '(?:a|b\\\\|c)', 'win32: commas'); +is($rw->convert('a\\,b\\\\,c'), '(?:a\\,b\\\\|c)', 'win32: escaped commas 1'); +is($rw->convert('a\\,b\\\\\\,c'), 'a\\,b\\\\\\,c', 'win32: escaped commas 2'); + +is($rw->convert(',a,b\\\\,'), '(?:|a|b\\\\|)', 'win32: commas at begin/end'); +is($rw->convert('\\,a,b\\\\\\,'), '(?:\\,a|b\\\\\\,)', + 'win32: escaped commas at begin/end');