]> git.vpit.fr Git - perl/modules/Regexp-Wildcards.git/blobdiff - t/21-commas.t
Major rewrite
[perl/modules/Regexp-Wildcards.git] / t / 21-commas.t
diff --git a/t/21-commas.t b/t/21-commas.t
new file mode 100644 (file)
index 0000000..1cdd0d0
--- /dev/null
@@ -0,0 +1,26 @@
+#!perl -T
+
+use strict;
+use warnings;
+
+use Test::More tests => 8;
+
+use Regexp::Wildcards;
+
+my $rw = Regexp::Wildcards->new(); # unix
+
+is($rw->convert('a,b,c'), 'a\\,b\\,c', 'unix: commas outside of brackets 1');
+is($rw->convert('a\\,b\\\\\\,c'), 'a\\,b\\\\\\,c',
+   'unix: commas outside of brackets 2');
+is($rw->convert(',a,b,c\\\\,'), '\\,a\\,b\\,c\\\\\\,',
+   'unix: commas outside of brackets at begin/ed');
+
+$rw = Regexp::Wildcards->new(type => 'commas');
+
+is($rw->convert('a,b\\\\,c'), '(?:a|b\\\\|c)', 'win32: commas');
+is($rw->convert('a\\,b\\\\,c'), '(?:a\\,b\\\\|c)', 'win32: escaped commas 1');
+is($rw->convert('a\\,b\\\\\\,c'), 'a\\,b\\\\\\,c', 'win32: escaped commas 2');
+
+is($rw->convert(',a,b\\\\,'), '(?:|a|b\\\\|)', 'win32: commas at begin/end');
+is($rw->convert('\\,a,b\\\\\\,'), '(?:\\,a|b\\\\\\,)',
+   'win32: escaped commas at begin/end');