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

When converting tests...

Thread Next
Markus Laire
December 20, 2004 07:28
When converting tests...
Message ID:
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 

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 Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About