Anyone want to contribute some cool tests?
I've just checked in code to add combined enumerated character
classes to PGE, enabling regexes like the following:
<+alpha+[_]> # alphabetic characters and underscores
<alpha-[jJ]> # alphabetic characters except 'j' or 'J'
<-digit> # any character except a digit
So far PGE has only one test for each of the first two forms.
That's clearly inadequate, as there are probably many other
combinations that we should be testing. So, patches and
contributions are greatly desired -- they probably belong in the
rx_charclass or rx_subrule files of t/compilers/pge/p6regex/ .
For reference, the specification that defines the syntax
is the "Extensible Metasyntax" section of Synopsis 5.
Thanks!
Pm
Excellent, thanks!
The two tests you contributed that were failing likely weren't testing
what you thought they were testing. The original tests were:
Pattern Target Match (y/n)
<-[ab]+[cd]>+ caad n
<+alpha-[Jj]>+ aJc n
Since the patterns are unanchored, the first test simply matches
any sequence of 'c' and 'd' characters, while the second matches
any sequence of alphabetic characters other than 'J' or 'j'.
So, being unconstrained, the first pattern matches the 'caad'
target by matching the initial 'c', and the second pattern
likewise matches the initial 'a'.
I've applied the patch (thanks!) and changed these two failing
tests to be anchored patterns, as in:
Pattern Target Match (y/n)
^<-[ab]+[cd]>+$ caad n
^<+alpha-[Jj]>+$ aJc n
They now work as expected.
Thanks again!
Pm
I've tried to add some tests to the rx_subrule with some extras
sensitive cases, but i'm failling two tests that i think that should
pass. I have attached a patch that adds new tests. The ones requiring
attention are the ones that fail. Not sure if i'm doing anything wrong
but my guess would be that couple of failling tests should pass ok.
Files affected:
* t/compilers/pge/p6regex/rx_subrules
Best regards,
./smash