6 use Test::More tests => 16;
10 my $rw = Regexp::Wildcards->new(do => 'anchors');
12 is($rw->convert('\\^'), '\\^', 'anchor: escape ^ 1');
13 is($rw->convert('\\\\\\^'), '\\\\\\^', 'anchor: escape ^ 2');
14 is($rw->convert('\\$'), '\\$', 'anchor: escape $ 1');
15 is($rw->convert('\\\\\\$'), '\\\\\\$', 'anchor: escape $ 2');
17 is($rw->convert('^a?b*'), '^a\\?b\\*', 'anchor: ^');
18 is($rw->convert('a?b*$'), 'a\\?b\\*$', 'anchor: $');
19 is($rw->convert('^a?b*$'), '^a\\?b\\*$', 'anchor: ^$');
20 is($rw->convert('x^a?b*$y'), 'x^a\\?b\\*$y', 'anchor: intermediate ^$');
22 $rw->do(add => 'jokers');
24 is($rw->convert('^a?b*'), '^a.b.*', 'anchor: ^ with jokers');
25 is($rw->convert('a?b*$'), 'a.b.*$', 'anchor: $ with jokers');
26 is($rw->convert('^a?b*$'), '^a.b.*$', 'anchor: ^$ with jokers');
27 is($rw->convert('x^a?b*$y'), 'x^a.b.*$y','anchor: intermediate ^$ with jokers');
29 $rw->do(add => 'brackets');
31 is($rw->convert('{^,a}?b*'), '(?:^|a).b.*', 'anchor: ^ with brackets');
32 is($rw->convert('a?{b*,$}'), 'a.(?:b.*|$)', 'anchor: $ with brackets');
33 is($rw->convert('{^a,?}{b,*$}'),'(?:^a|.)(?:b|.*$)','anchor: ^$ with brackets');
34 is($rw->convert('x{^,a}?b{*,$}y'), 'x(?:^|a).b(?:.*|$)y',
35 'anchor: intermediate ^$ with brackets');