Skip to content
This repository has been archived by the owner on Feb 3, 2021. It is now read-only.

Commit

Permalink
Add remaining test files from PGE (not active/configured yet).
Browse files Browse the repository at this point in the history
  • Loading branch information
pmichaud committed Oct 13, 2009
1 parent 5045605 commit 032c58a
Show file tree
Hide file tree
Showing 5 changed files with 288 additions and 0 deletions.
33 changes: 33 additions & 0 deletions t/p6regex/rx_backtrack
@@ -0,0 +1,33 @@
## Backtracking control tests
a* a bazaar y control
# todo :pge<adverbs before backtrack(?)>
a*:a bazaar /:a/ basic
a*: a bazaar n basic
^[a|b]* aba abbabbababba y control
^[a|b]*: aba abbabbababba n outside a group
\d+: 123abc y cut on character class shortcut
\d+: abc n cut on character class shortcut
[ if not | ify ] verify y control
[ if :: not | ify ] verify n inside a group
if :: not | ify verify n the default all group
# todo :pugs<feature>
[ if : not | ify ] verify y simple backtrack still works
# todo :pugs<feature>
[ if :: not | ify ] | verify verify y rule continues
[ when ever ] | whence whence y full backtrack failure
[ when ::: ever ] | whence whence n full backtrack failure
# todo :pugs<feature>
ab::cd | gh::ij xyabghij y group cut at top
ab:::cd | gh:::ij xyabghij n rule cut at top
# todo :pugs<feature>
[ab::cd | gh::ij] xyabghij y group cut in group
[ab:::cd | gh:::ij] xyabghij n rule cut in group
[ ab | abc ]: de xyzabcde n no backtrack into group
( ab | abc ): de xyzabcde n no backtrack into subpattern
# todo :pugs<feature>
[ when <commit> ever ] | whence whence n full backtrack failure

:ratchet a* a bazaar n ratchet modifier
:ratchet a*! a bazaar y force backtracking !

## vim: noexpandtab tabstop=4 shiftwidth=4
12 changes: 12 additions & 0 deletions t/p6regex/rx_goal
@@ -0,0 +1,12 @@
## Goal tests
'(' ~ ')' \d+ (123) y basic goal syntax
'(' ~ ')' \d+ (123 /couldn't find final/ missing goal
'(' ~ ')' \d+ (123abc) /couldn't find final/ stuff before goal
'(' ~ ')' \d+ (abc) n can't match internal stuff
'(' ~ ')' \d+ () n missing internal stuff
['('] ~ [')'] [\d \d+] (123) y goal syntax with brackets
('(') ~ (')') (\d \d+) (123) y goal syntax with parenthesis
'(' ~ <[()]> \d+ (123) y non-literal goal
'(' ~ <[()]> \d+ (123( y non-literal goal
'(' ~ <[()]> \d+ (123] /Unable to parse/ failing non-literal goal
:dba('zz') '(' ~ ')' \d+ (123 /zz/ :dba adverb
48 changes: 48 additions & 0 deletions t/p6regex/rx_lookarounds
@@ -0,0 +1,48 @@
## lookarounds
<before .d> a. abacad /mob: <ad @ 4>/ lookahead <before>
<before c> .... abacad n lookahead <before>
<before> . abcd n null <before>
<!before ..b> aa aabaaa /mob: <aa @ 3>/ negated lookahead
# todo :pugs<feature>
<after a>b ab y lookbehind <after>
<after a>b cb n lookbehind <after>
<after a>b b n lookbehind <after>
# todo :pugs<feature>
<!after c>b ab y lookbehind <!after>
<!after c>b cb n lookbehind <!after>
# todo :pugs<feature>
<!after c>b b y lookbehind <!after>
<!after <[cd]>>b dbcb n lookbehind <!after>
# todo :pugs<feature>
<!after <[cd]>><[ab]> dbaacb y lookbehind <!after>
<!after c|d>b dbcb n lookbehind <!after>
# todo :pugs<feature>
<!after c|d><[ab]> dbaacb y lookbehind <!after>
# todo :pugs<feature>
<!after cd><[ab]> cbaccb y lookbehind <!after>
# todo :pugs<feature>
$ <after ^a> a y lookbehind <after>
# todo :pugs<feature>
<after x+>y axxbxxyc y lookbehind <after>
<[a..z]>+ az y metasyntax with leading + (<+...>)
<+[a..z]>+ az y metasyntax with leading + (<+...>)
<+alpha>+ az y metasyntax with leading + (<+...>)

<?> '' y null pattern (<?>)
^ <?> \t\n\r !"#$%&'()*+,-./:;<=>?@[\]^`_{|}0123456789ABCDEFGHIJabcdefghij y null pattern (<?>)
<?> $ \t\n\r !"#$%&'()*+,-./:;<=>?@[\]^`_{|}0123456789ABCDEFGHIJabcdefghij y null pattern (<?>)
abc <?> def \t\n\r !"#$%&'()*+,-./:;<=>?@[\]^`_{|}0123456789ABCDEFGHIJabcdefghij y null pattern (<?>)
x | y | <?> \t\n\r !"#$%&'()*+,-./:;<=>?@[\]^`_{|}0123456789ABCDEFGHIJabcdefghij y null pattern (<?>)
x | y | <?> \t\n\r !"#$%&'()*+,-./:;<=>?@[\]^`_{|}0123456789ABCDEFGHIJabcdefghij y null pattern (<?>)

abc <!> def \t\n\r !"#$%&'()*+,-./:;<=>?@[\]^`_{|}0123456789ABCDEFGHIJabcdefghij n fail pattern <!>

a[b} \t\n\r !"#$%&'()*+,-./:;<=>?@[\]^`_{|}0123456789ABCDEFGHIJabcdefghij /rule error/ mismatched close

c <before .d> abacad /mob: <c @ 3>/ one character and lookahead <before>
.* <before .d> abacad /mob: <abac @ 0>/ multiple characters and lookahead <before>
.* <before .\<> abaca<d /mob: <abac @ 0>/ multiple characters and lookahead <before> with a '<'
.* <before \<> aba<ca<d /mob: <aba<ca @ 0>/ greedy any character and lookahead <before> with a '<'
.*? <before \<> aba<ca<d /mob: <aba @ 0>/ non-greedy any character and lookahead <before> with a '<'

## vim: noexpandtab tabstop=4 shiftwidth=4
154 changes: 154 additions & 0 deletions t/p6regex/rx_modifiers
@@ -0,0 +1,154 @@
## modifiers
:i bcd abcdef y ignorecase (:i)
:i bcd aBcdef y ignorecase (:i)
:i bcd abCdef y ignorecase (:i)
:i bcd abcDef y ignorecase (:i)
:i bcd abc-ef n ignorecase (:i)
:ignorecase bcd abcdef y ignorecase (:ignorecase)
:ignorecase bcd aBCDef y ignorecase (:ignorecase)
:ignorecase bcd abc-ef n ignorecase (:ignorecase)
# todo :pugs<feature>
:i(0) bcd abcdef y ignorecase, repetition (:i(0))
:i(0) bcd abCdef n ignorecase, repetition (:i(0))
# todo :pugs<feature>
:i(1) bcd abcdef y ignorecase, repetition (:i(1))
# todo :pugs<feature>
:i(1) bcd abCdef y ignorecase, repetition (:i(1))
:i(1) bcd aBxDef n ignorecase, repetition (:i(1))
# todo :pugs<feature>
:0i bcd abcdef y ignorecase, repetition (:0i)
:0i bcd abCdef n ignorecase, repetition (:0i)
# todo :pugs<feature>
:1i bcd abcdef y ignorecase, repetition (:1i)
# todo :pugs<feature>
:1i bcd abCdef y ignorecase, repetition (:1i)
# todo :pugs<feature>
:1i bcd aBCDef y ignorecase, repetition (:1i)
:1i bcd aBxDef n ignorecase, repetition (:1i)
ab [:i cd ] ef abcdef y ignorecase, lexical (:i)
ab [:i cd ] ef abCdef y ignorecase, lexical (:i)
ab [:i cd ] ef abcDef y ignorecase, lexical (:i)
ab [:i cd ] ef abCDef y ignorecase, lexical (:i)
ab [:i cd ] ef aBCDef n ignorecase, lexical (:i)
ab [:i cd ] ef abCDEf n ignorecase, lexical (:i)
:i ab [:i cd ] ef abCDef y ignorecase, lexical (:i)
:i ab [:i cd ] ef AbCDeF y ignorecase, lexical (:i)
:i ab [:i cd ] ef AbcdeF y ignorecase, lexical (:i)
# todo :pugs<feature>
:i a [:i(0) b [:i(1) c [:0i d [:1i e [:i(0) f ] ] ] ] ] AbCdEf y ignorecase, lexical (:i)
# todo :pugs<feature>
:i aa [:i(0) bb [:i(1) cc [:0i dd [:1i ee [:i(0) ff ] ] ] ] ] AabbCcddEeff y ignorecase, lexical (:i)
:i a [:i(0) b [:i(1) c [:0i d [:1i e [:i(0) f ] ] ] ] ] AbCdEF n ignorecase, lexical (:i)
:i aa [:i(0) bb [:i(1) cc [:0i dd [:1i ee [:i(0) ff ] ] ] ] ] AabbCcddEeFf n ignorecase, lexical (:i)
# todo :pugs<feature>
:i ab [:i(0) cd ] ef AbcdeF y ignorecase, lexical repetition (:i)
# todo :pugs<feature> :pge<feature>
:i ab [:!i cd ] ef AbcdeF y ignorecase, lexical repetition (:i)
# todo :pugs<feature>
:i ab [:0i cd ] ef AbcdeF y ignorecase, lexical repetition (:i)
# todo :pugs<feature>
:0i ab [:1i cd ] ef abCDef y ignorecase, lexical repetition (:i)
:0i ab [:1i cd ] ef AbCDeF n ignorecase, lexical repetition (:i)
:0i ab [:1i cd ] ef AbcdeF n ignorecase, lexical repetition (:i)
# todo :pugs<feature>
:0i ab [:i(0) cd ] ef abcdef y ignorecase, lexical repetition (:i)
:0i ab [:1i cd ] ef AbcdeF n ignorecase, lexical repetition (:i)
# todo :pugs<feature>
:i(1) ab [:1i cd ] ef AbCdeF y ignorecase, lexical repetition (:i)
# todo :pugs<feature>
:i(1) ab [:i(0) cd ] ef AbcdeF y ignorecase, lexical repetition (:i)
:i(1) ab [:i(0) cd ] ef AbcDeF n ignorecase, lexical repetition (:i)
# todo :pugs<feature>
:i(2) ab [:i(999) cd ] ef ABCDEF y ignorecase, lexical repetition (:i)
# todo :pugs<feature>
:1i ab [:i(1) cd ] ef ABCDEF y ignorecase, lexical repetition (:i)
:0i ab [:1i cd ] ef abcDeF n ignorecase, lexical repetition (:i)
# todo :pugs<feature>
:2i ab [:999i cd ] ef ABCDEF y ignorecase, lexical repetition (:i)
ab [:ignorecase cd ] ef abCDef y ignorecase, lexical (:ignorecase)
ab [:ignorecase cd ] ef aBCDef n ignorecase, lexical (:ignorecase)
# todo :pugs<feature>
:1ignorecase ab [:ignorecase(1) cd ] ef ABCDEF y ignorecase, lexical repetition (:ignorecase)
# todo :pugs<feature>
:s bcd a bcdef y sigspace (:s)
# todo :pugs<feature>
:s bcd a bcd ef y sigspace (:s)
:s bcd abcdef n sigspace (:s)
:s bcd abcd ef n sigspace (:s)
:s bcd ab cdef n sigspace (:s)
# todo :pugs<feature>
:s b c d a b c d ef y sigspace (:s)
# todo :pugs<feature>
:s b c d a b c def y sigspace (:s)
:s b c d ab c d ef n sigspace (:s)
:s b c d a bcdef n sigspace (:s)
:s b c d abcdef n sigspace (:s)
# todo :pugs<feature>
:sigspace bcd a bcdef y sigspace (:sigspace)
# todo :pugs<feature>
:sigspace bcd a bcd ef y sigspace (:sigspace)
:sigspace bcd abcdef n sigspace (:sigspace)
# todo :pugs<feature>
:sigspace b c d a b c d ef y sigspace (:sigspace)
# todo :pugs<feature>
:sigspace b c d a b c def y sigspace (:sigspace)
:sigspace b c d ab c d ef n sigspace (:sigspace)
# todo :pugs<feature>
:s(1) b c [:s(0) d e f ] a b c def y sigspace, lexical repetition (:s)
# todo :pugs<feature> :pge<feature>
:s b c [:!s d e f ] a b c def y sigspace, lexical repetition (:s)
:s(0) b c [:s(1) d e f ] a b c def n sigspace, lexical repetition (:s)
# todo :pge<feature>
:!s b c [:s d e f ] a b c def n sigspace, lexical repetition (:s)
:s(0) b c [:s(0) d e f ] a b c def n sigspace, lexical repetition (:s)
# todo :pge<feature>
:!s b c [:!s d e f ] a b c def n sigspace, lexical repetition (:s)
# todo :pugs<feature>
:s ab ab y sigspace, trailing ws
foo\s*'-'?\s*bar foo\t \n-\n\t bar y basic match
foo\s*'-'?\s*bar foo - bar y basic match
foo\s+'-'?\s*bar foo bar y basic match \s+ \s*
foo\s+'-'?\s*bar foo -bar y basic match \s+ \s*
foo\s*'-'?\s+bar foo- bar y basic match \s* \s+
foo '-'? bar foo-bar y basic match \s* \s*
foo '-'? bar foobar y basic match
foo '-'? bar foo - bar n basic non-match
# todo :pugs<feature>
:s foo '-'? bar foo\n \t- \t\t\nbar y basic ws match
# todo :pugs<feature>
:s foo '-'? bar foo - bar y basic ws match
# todo :pugs<feature>
:s foo '-'? bar foo bar y basic ws match \s+ \s*
# todo :pugs<feature>
:s foo '-'? bar foo -bar y basic ws match \s+ \s*
# todo :pugs<feature>
:s foo '-'? bar foo- bar y basic ws match \s* \s+
# todo :pugs<feature>
:s foo '-'? bar foo-bar y basic ws match \s* \s*
:s foo '-'? bar foobar n basic ws non-match
:s()foo '-'? bar foo - bar n basic ws match
# todo :pugs<feature> :pge<feature>
:s[]foo '-'? bar foo - bar y basic ws match
# todo :pugs<feature>
:s<?wb>foo '-'? bar foo - bar y basic ws match with boundary modifier separation
# todo :pugs<feature>
:s::foo '-'? bar foo - bar y basic ws match with backtrack no-op modifier separation
:s::(\w+) ':=' (\S+) dog := spot /mob 0: <dog @ 0>/ sigspace and capture together
:s::(\w+) ':=' (\S+) dog := spot /mob 1: <spot @ 7>/ sigspace and capture together
# todo :pugs<feature> :pge<feature>
:perl5 \A.*? bcd\Q$\E..\z a bcd$ef y perl5 syntax (:perl5)
# todo :pugs<feature>
:x(6) \d 123456 y repetition (:x)
# todo :pugs<feature>
:x(3) \d 123456 y repetition (:x)
# todo :pugs<feature>
:x(0) \d 123456 y repetition (:x)
# todo :pugs<feature>
:nth(3) a \d a1a2a3 y nth occurance (:nth)
# todo :pge<feature>
:nth(4) a \d a1a2a3 n nth occurance (:nth)
# todo :pge<feature>
:nth(0) a \d a1a2a3 n nth occurance (:nth)
:s^[\d+ ]* abc 11 12 13 abc y <?ws> before closing bracket

## vim: noexpandtab tabstop=4 shiftwidth=4
41 changes: 41 additions & 0 deletions t/p6regex/rx_syntax
@@ -0,0 +1,41 @@
## syntax errors

{{ abcdef /Missing closing braces/ unterminated closure
\1 abcdef /reserved/ back references
\x[ abcdef /Missing close bracket/ unterminated \x[..]
\X[ abcdef /Missing close bracket/ unterminated \X[..]

* abc abcdef /Quantifier follows nothing/ bare * at start
* abc abcdef /Quantifier follows nothing/ bare * after ws
[*|a] abcdef /Quantifier follows nothing/ bare * after [
[ *|a] abcdef /Quantifier follows nothing/ bare * after [+sp
[a|*] abcdef /Quantifier follows nothing/ bare * after |
[a| *] abcdef /Quantifier follows nothing/ bare * after |+sp

+ abc abcdef /Quantifier follows nothing/ bare + at start
+ abc abcdef /Quantifier follows nothing/ bare + after ws
[+|a] abcdef /Quantifier follows nothing/ bare + after [
[ +|a] abcdef /Quantifier follows nothing/ bare + after [+sp
[a|+] abcdef /Quantifier follows nothing/ bare + after |
[a| +] abcdef /Quantifier follows nothing/ bare + after |+sp

? abc abcdef /Quantifier follows nothing/ bare ? at start
? abc abcdef /Quantifier follows nothing/ bare ? after ws
[?|a] abcdef /Quantifier follows nothing/ bare ? after [
[ ?|a] abcdef /Quantifier follows nothing/ bare ? after [+sp
[a|?] abcdef /Quantifier follows nothing/ bare ? after |
[a| ?] abcdef /Quantifier follows nothing/ bare ? after |+sp

: abc abcdef /Quantifier follows nothing/ bare : at start
: abc abcdef /Quantifier follows nothing/ bare : after ws
[:|a] abcdef /Quantifier follows nothing/ bare : after [
[ :|a] abcdef /Quantifier follows nothing/ bare : after [+sp
[a|:] abcdef /Quantifier follows nothing/ bare : after |
[a| :] abcdef /Quantifier follows nothing/ bare : after |+sp

abcdef /Null pattern illegal/ null pattern
abcdef /Null pattern illegal/ ws null pattern

=abc abcdef /LHS of alias must be lvalue/ bare : after ws
[ =a] abcdef /LHS of alias must be lvalue/ bare : after [+sp
[a| =a] abcdef /LHS of alias must be lvalue/ bare : after |+sp

0 comments on commit 032c58a

Please sign in to comment.