develooper Front page | perl.perl6.compiler | Postings from December 2004

When converting tests...

Thread Next
From:
Markus Laire
Date:
December 20, 2004 07:28
Subject:
When converting tests...
Message ID:
41C6EF69.8020000@laire.info
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>

Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About