Skip to content

Commit

Permalink
[spec] more tests for longest alternatives in regexes
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.pugscode.org/pugs@20882 c213334d-75ef-0310-aa23-eaa082d1ae64
  • Loading branch information
moritz committed Jun 19, 2008
1 parent 8284e1c commit af6b45d
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion S05-alternation/longest-alternative.t
@@ -1,7 +1,7 @@
use v6;
use Test;

plan 6;
plan 14;

#L<S05/Unchanged syntactic features/"While the syntax of | does not change">

Expand All @@ -16,4 +16,20 @@ is ~$/, 'aa', 'Longest alternative wins 2';
ok $str ~~ m:g/a|aa|aaaa/, 'Third match still works';
is ~$/, 'a', 'Only one alternative left';

ok $str !~~ m:g/a|aa|aaaa/, 'No fourth match';

# now test with different order in the regex - it shouldn't matter at all

ok $str ~~ m:g/aa|a|aaaa/, 'basic sanity with |, different order';
is ~$/, 'aaaa', 'Longest alternative wins 1, different order';

ok $str ~~ m:g/aa|a|aaaa/, 'Second match still works, different order';
is ~$/, 'aa', 'Longest alternative wins 2, different order';

ok $str ~~ m:g/aa|a|aaaa/, 'Third match still works, different order';
is ~$/, 'a', 'Only one alternative left, different order';

ok $str !~~ m:g/aa|a|aaaa/, 'No fourth match, different order';


# vim: ft=perl6

0 comments on commit af6b45d

Please sign in to comment.