23-groups.t 649 B

123456789101112131415161718
  1. #!perl -T
  2. use strict;
  3. use warnings;
  4. use Test::More tests => 6;
  5. use Regexp::Wildcards;
  6. my $rw = Regexp::Wildcards->new(do => [ qw<jokers brackets groups> ]);
  7. is($rw->convert('a(?)b'), 'a(.)b', 'groups: single');
  8. is($rw->convert('a(*)b'), 'a(.*)b', 'groups: any');
  9. is($rw->convert('(a),(b)'), '(a)\\,(b)', 'groups: commas');
  10. is($rw->convert('a({x,y})b'), 'a((?:x|y))b', 'groups: brackets');
  11. is($rw->convert('a({x,(y?),{z,(t*u)}})b'), 'a((?:x|(y.)|(?:z|(t.*u))))b',
  12. 'groups: nested');
  13. is($rw->convert('(a*\\(b?\\))'), '(a.*\\(b.\\))', 'groups: escape');