]> git.vpit.fr Git - perl/modules/Regexp-Wildcards.git/blob - t/21-commas.t
Major rewrite
[perl/modules/Regexp-Wildcards.git] / t / 21-commas.t
1 #!perl -T
2
3 use strict;
4 use warnings;
5
6 use Test::More tests => 8;
7
8 use Regexp::Wildcards;
9
10 my $rw = Regexp::Wildcards->new(); # unix
11
12 is($rw->convert('a,b,c'), 'a\\,b\\,c', 'unix: commas outside of brackets 1');
13 is($rw->convert('a\\,b\\\\\\,c'), 'a\\,b\\\\\\,c',
14    'unix: commas outside of brackets 2');
15 is($rw->convert(',a,b,c\\\\,'), '\\,a\\,b\\,c\\\\\\,',
16    'unix: commas outside of brackets at begin/ed');
17
18 $rw = Regexp::Wildcards->new(type => 'commas');
19
20 is($rw->convert('a,b\\\\,c'), '(?:a|b\\\\|c)', 'win32: commas');
21 is($rw->convert('a\\,b\\\\,c'), '(?:a\\,b\\\\|c)', 'win32: escaped commas 1');
22 is($rw->convert('a\\,b\\\\\\,c'), 'a\\,b\\\\\\,c', 'win32: escaped commas 2');
23
24 is($rw->convert(',a,b\\\\,'), '(?:|a|b\\\\|)', 'win32: commas at begin/end');
25 is($rw->convert('\\,a,b\\\\\\,'), '(?:\\,a|b\\\\\\,)',
26    'win32: escaped commas at begin/end');