6 use Test::More tests => 10;
10 my $rw = Regexp::Wildcards->new();
12 my $wc = 'a,b{c,d}e*f?(g)';
13 my $none = quotemeta $wc;
14 my $unix = 'a\\,b(?:c|d)e.*f.\\(g\\)';
15 my $win32 = '(?:a|b\{c|d\}e.*f.\\(g\\))';
16 my $jokers = 'a\\,b\\{c\\,d\\}e.*f.\\(g\\)';
17 my $groups = 'a\\,b\\{c\\,d\\}e\\*f\\?(g)';
18 my $jok_gr = 'a\\,b\\{c\\,d\\}e.*f.(g)';
20 is($rw->convert($wc), $unix, 'nothing defaults to unix');
22 is($rw->convert($wc), $win32, 'set to win32');
24 is($rw->convert($wc), $unix, 'set to darwin');
26 is($rw->convert($wc), $win32, 'reset to win32');
28 is($rw->convert($wc), $unix, 'reset to unix');
30 $rw = Regexp::Wildcards->new(do => [ qw/jokers/ ], type => 'win32');
31 is($rw->convert($wc), $jokers, 'do overrides type in new');
32 $rw->do(add => 'groups');
33 is($rw->convert($wc), $jok_gr, 'added groups to jokers');
34 $rw->do(add => 'jokers');
35 is($rw->convert($wc), $jok_gr, 'added jokers but it already exists');
36 $rw->do(rem => 'jokers');
37 is($rw->convert($wc), $groups, 'removed jokers, only groups remains');
39 is($rw->convert($wc), $none, 'reset do');