Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

[perl #40646] [TODO] PGE - add tests for <alpha+[_]>, <alpha-[Jj]>, etc.

4 views
Skip to first unread message

Patrick R . Michaud

unread,
Nov 1, 2006, 10:52:40 PM11/1/06
to bugs-bi...@rt.perl.org
# New Ticket Created by Patrick R. Michaud
# Please include the string: [perl #40646]
# in the subject line of all future correspondence about this issue.
# <URL: http://rt.perl.org/rt3/Ticket/Display.html?id=40646 >


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

Patrick R. Michaud

unread,
Nov 23, 2006, 10:54:42 PM11/23/06
to Nuno Carvalho via RT
On Thu, Nov 23, 2006 at 03:09:11PM -0800, Nuno Carvalho via RT wrote:
> 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.

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

Nuno Carvalho via RT

unread,
Nov 23, 2006, 6:09:11 PM11/23/06
to perl6-i...@perl.org
Hi,

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

rx_subrules.patch
0 new messages