]> git.vpit.fr Git - perl/modules/Regexp-Wildcards.git/blobdiff - t/10-jokers.t
Importing Regexp-Wildcards-0.04.tar.gz
[perl/modules/Regexp-Wildcards.git] / t / 10-jokers.t
index 67a1fd8ac2b206f6d89039ea02c564e461857d5e..85c9ede9ce0b1e7de26dbf21205b97390da63397 100644 (file)
@@ -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 *', '\\*';