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

When converting tests...

3 views
Skip to first unread message

Markus Laire

unread,
Dec 20, 2004, 10:27:37 AM12/20/04
to perl6-c...@perl.org
How should I convert dot, $, ...

Some examples:

1# p5: "abc" =~ /a.c/; (match)
2# p5: "a\nc" =~ /a.c/; (no match)

Equivalent code for '.' would now be '\N'. Still there are tests where I
could just leave the dot alone (e.g. all tests where there is no \n in
target-string.)

In test-1 I could leave dot alone to get a test which tests similar
concept (dot matching single char).

In test-2 I must change dot to \N to retain the idea of the test.

Still I could just change dot to \N in both tests. But then I wouldn't
get a test for a dot...


Similar problem exists for $. When there is no //m modifier, and no \n
in the end, I could just keep $.

When there is \n in the end (but no //m), I could change $ to be \n?$

Of course I could change $ to be \n?$ even when there is no \n in the
string. But should I?


So should I convert items like dot or $ depending on the string I know
test will match the rule against (like whether it contains \n or not) -
or should I convert these items allways in the same way.


(Of course once perl6-rules starts working a lot better than now, we
anyway need totally new tests to consider all the new possibilities.)

--
Markus Laire
<Jam. 1:5-6>

Patrick R. Michaud

unread,
Dec 20, 2004, 4:12:24 PM12/20/04
to perl6-c...@perl.org
On Mon, Dec 20, 2004 at 05:27:37PM +0200, Markus Laire wrote:
> How should I convert dot, $, ...
>
> 1# p5: "abc" =~ /a.c/; (match)
> 2# p5: "a\nc" =~ /a.c/; (no match)
>
> Equivalent code for '.' would now be '\N'. Still there are tests where I
> could just leave the dot alone (e.g. all tests where there is no \n in
> target-string.)

These are cases where I think the p5 tests each need to become
multiple tests in the p6rules suite. The above tests probably should
go into the p6rules suite as

"abc" /a.c/ (match)
"a\nc" /a.c/ (match)
"abc" /a\Nc/ (match)
"a\nc" /a\Nc/ (no match)

so that we get all of the cases implied by #1 and #2 above.

I think this also points to why we might want to just do as much
autoconverting of 're_tests' as we can at the beginning, and then
decide we've done enough and maintain things manually from there.

Pm

0 new messages