X-Git-Url: http://git.vpit.fr/?p=perl%2Fmodules%2FRegexp-Wildcards.git;a=blobdiff_plain;f=t%2F10-jokers.t;fp=t%2F10-jokers.t;h=85c9ede9ce0b1e7de26dbf21205b97390da63397;hp=67a1fd8ac2b206f6d89039ea02c564e461857d5e;hb=6305572fe1d1790682966644ede8f267f22bd1d1;hpb=eafc1dab0ebd73e592fda42a9db18d6d4a64c96b diff --git a/t/10-jokers.t b/t/10-jokers.t index 67a1fd8..85c9ede 100644 --- a/t/10-jokers.t +++ b/t/10-jokers.t @@ -1,6 +1,6 @@ #!perl -T -use Test::More tests => 3 * (4 + 2 + 9 + 2) * 3; +use Test::More tests => 3 * (4 + 2 + 7 + 9 + 2) * 3; use Regexp::Wildcards qw/wc2re/; @@ -31,6 +31,27 @@ for my $t (qw/unix win32 jokers/) { try $t, 'multiple *', '**', '.*'; try $t, 'multiple ?', '??', '..'; + # Variables + + { + local $Regexp::Wildcards::CaptureSingle = 1; + try $t, 'multiple capturing ?', '??\\??', '(.)(.)\\?(.)'; + local $Regexp::Wildcards::CaptureAny = 1; + try $t, 'multiple capturing * (greedy)', '**\\**', '(.*)\\*(.*)'; + try $t, 'multiple capturing * (greedy) and capturing ?', + '**??\\??\\**', '(.*)(.)(.)\\?(.)\\*(.*)'; + $Regexp::Wildcards::CaptureSingle = 0; + try $t, 'multiple capturing * (greedy) and non-capturing ?', + '**??\\??\\**', '(.*)..\\?.\\*(.*)'; + $Regexp::Wildcards::CaptureAny = -1; + try $t, 'multiple capturing * (non-greedy)', '**\\**', '(.*?)\\*(.*?)'; + try $t, 'multiple capturing * (non-greedy) and non-capturing ?', + '**??\\??\\**', '(.*?)..\\?.\\*(.*?)'; + $Regexp::Wildcards::CaptureSingle = 1; + try $t, 'multiple capturing * (non-greedy) and capturing ?', + '**??\\??\\**', '(.*?)(.)(.)\\?(.)\\*(.*?)'; + } + # Escaping try $t, 'escaping *', '\\*';