t/compilers/pge/p5regex/p5rx.t - Perl 5 Regular Expression tests


These tests are ripped from the Perl 5.9.2 distribution. The test harness has been modified to feed them to PGE's P5Regex compiler. The tests are in a separate file in the same directory, named 're_tests'.

This test harness honors a special environment variable called TEST_P5RX. If set to a number, that test will be run alone and unconditionally--even if it's designated as SKIP or TODO by the harness. This is quite helpful in debugging tests that cause parrot to spiral out of control. {{ XXX }}

NOTE: Don't add new tests to re_tests. That file is strictly for Perl 5's tests.

The Perl 5 equivalent file provides the following description of the test format. There are 5-6 columns, separated by tabs.

Column 1 contains the pattern, optionally enclosed in ''. Modifiers can be put after the closing '.

Column 2 contains the string to be matched.

Column 3 contains the expected result: y expect a match n expect no match c expect an error B test exposes a known bug in Perl, should be skipped b test exposes a known bug in Perl, should be skipped if noamp

Columns 4 and 5 are used only if column 3 contains y or c.

Column 4 contains a string, usually $&.

Column 5 contains the expected result of double-quote interpolating that string after the match, or start of error message.

Column 6, if present, contains a description of what is being tested.

\n in the tests are interpolated, as are variables of the form ${\w+}.


    % prove t/compilers/pge/p5regex/p5rx.t


Note that while our job would be easier if we could use regular expressions in here, but we want to avoid any dependency on the thing we're testing.

Need to add in test ids, to avoid the precarious line numbering.