X-Git-Url: http://git.vpit.fr/?a=blobdiff_plain;f=t%2F23-groups.t;fp=t%2F23-groups.t;h=9b36dc2902f176bc391dfae24c3ee6b86d621020;hb=fbd767d1d92b735a6509e57ccfbd73b45845081e;hp=0000000000000000000000000000000000000000;hpb=5468cc9fedae639e785117ab38807d857c84bdec;p=perl%2Fmodules%2FRegexp-Wildcards.git diff --git a/t/23-groups.t b/t/23-groups.t new file mode 100644 index 0000000..9b36dc2 --- /dev/null +++ b/t/23-groups.t @@ -0,0 +1,18 @@ +#!perl -T + +use strict; +use warnings; + +use Test::More tests => 6; + +use Regexp::Wildcards; + +my $rw = Regexp::Wildcards->new(do => [ qw/jokers brackets groups/ ]); + +is($rw->convert('a(?)b'), 'a(.)b', 'groups: single'); +is($rw->convert('a(*)b'), 'a(.*)b', 'groups: any'); +is($rw->convert('(a),(b)'), '(a)\\,(b)', 'groups: commas'); +is($rw->convert('a({x,y})b'), 'a((?:x|y))b', 'groups: brackets'); +is($rw->convert('a({x,(y?),{z,(t*u)}})b'), 'a((?:x|(y.)|(?:z|(t.*u))))b', + 'groups: nested'); +is($rw->convert('(a*\\(b?\\))'), '(a.*\\(b.\\))', 'groups: escape');