21-commas.t 861 B

1234567891011121314151617181920212223242526
  1. #!perl -T
  2. use strict;
  3. use warnings;
  4. use Test::More tests => 8;
  5. use Regexp::Wildcards;
  6. my $rw = Regexp::Wildcards->new(); # unix
  7. is($rw->convert('a,b,c'), 'a\\,b\\,c', 'unix: commas outside of brackets 1');
  8. is($rw->convert('a\\,b\\\\\\,c'), 'a\\,b\\\\\\,c',
  9. 'unix: commas outside of brackets 2');
  10. is($rw->convert(',a,b,c\\\\,'), '\\,a\\,b\\,c\\\\\\,',
  11. 'unix: commas outside of brackets at begin/end');
  12. $rw = Regexp::Wildcards->new(type => 'commas');
  13. is($rw->convert('a,b\\\\,c'), '(?:a|b\\\\|c)', 'win32: commas');
  14. is($rw->convert('a\\,b\\\\,c'), '(?:a\\,b\\\\|c)', 'win32: escaped commas 1');
  15. is($rw->convert('a\\,b\\\\\\,c'), 'a\\,b\\\\\\,c', 'win32: escaped commas 2');
  16. is($rw->convert(',a,b\\\\,'), '(?:|a|b\\\\|)', 'win32: commas at begin/end');
  17. is($rw->convert('\\,a,b\\\\\\,'), '(?:\\,a|b\\\\\\,)',
  18. 'win32: escaped commas at begin/end');