File: 21-commas.t

package info (click to toggle)
libregexp-wildcards-perl 1.05-3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 184 kB
  • sloc: perl: 489; makefile: 2
file content (26 lines) | stat: -rw-r--r-- 861 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
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/end');

$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');