-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathunit test.pl
51 lines (46 loc) · 1.99 KB
/
unit test.pl
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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
use VeryKiwiFilter;
sub test_command{
my ($command) = @_;
print 'put entire query: '; print "$command\n";
print command_to_output($command), "\n\n";
}
my @testcommands = ( # REMEMBER YOU MUST ESCAPE SLOSHES IN PERL STRINGS THEMSELVES
#TESTS:
#end bracket delim:
's)\\\\cancel\\{\\d+\\})CANCELED)gx', # valid
's)\\\\cancel\\{\\d+\\})CANCELED))gi', # invalid
'sq>\\cancel{4}>CANCELEDFOUR>g', # valid
'sq$doo bee doo bee$replace$xg', # invalid (sq x combination)
#open bracket dlim:
's[\\\\cancel\\{\\d+\\}][CANCELED]gx', # valid
's(\\\\canc(el\\{\\d+\\})(CANCELED)gi', # invalid
'sq<\\cancel{4}><CANCELEDFOUR>g', # valid
'sq{doo bee doo bee}{replace}sg', # invalid (sq s combination)
#nested:
's{\\\\cancel\\{\\d+\\}}{CANCELED}gxsim', # valid
's{\\\\can}cel\\{\\d+\\}}{CANCELED}gxsim', # invalid
's( ( ) () ( )() )( )', # valid
's( ( ) (\\) ( )() )( )', # invalid
's<ab(c()d)ef\\\\\\\\<<>>gh<ij<<<>>>k>l><replace<<<>>> <> >o', # valid
's<ab(c()d)ef\\\\\\<<>>gh<ij<<<>>>k>l><replace<<<>>> <> >o', # invalid
'sq{\\\\cancel\\{\\d+\\}}{CANCELED}ipom', # valid
'sq{\\\\can}cel\\{\\d+\\}}{CANCELED}', # invalid
'sq( ( ) () ( )() )( )', # valid
'sq( ( ) (\\) ( )() )( )', # valid
'sq<ab(c()d)ef\\\\\\\\<<>>gh<ij<<<>>>k>l><replace<<<>>> <> >o', # valid
'sq<ab(c()d)ef\\\\\\<<>>gh<ij<<<>>>k>l><replace<<<>>> <> >o', # valid
'sq<ab(c()d)ef\\\\\\<<>>gh<ij<<<>>>k>l><replace<<<>>> <> >e', # invalid (sq e combination)
'sq<ab(c()d)ef\\\\\\<<>>gh<ij<<<>>>k>l><replace<<<>>> <> >r', # invalid (sq r combination)
#create a regex and save it.
#create a quoted regex and save it. This one:
# sq#~!@$%^&*()_+QWERTYUIOP{}|:"NM<>?/.,#MEREPLACE~!@$%^&*()_+QWERTYUIOP{}|:"NM<>?/.,MEREPLCAEEE!:)#gi save as weird
# perform a saved regex on content!
# the above one.
);
foreach (@testcommands){ test_command($_) }
=test
use VeryKiwiCommand;
my $c = VeryKiwiCommand->new('s/');
print 'regex is '.$c->regex->regex."\n";
print 'suffix is '.$c->suffix."\n";
=cut