| 1 |
nigel |
41 |
The perltest program |
| 2 |
|
|
-------------------- |
| 3 |
|
|
|
| 4 |
|
|
The perltest program tests Perl's regular expressions; it has the same |
| 5 |
|
|
specification as pcretest, and so can be given identical input, except that |
| 6 |
|
|
input patterns can be followed only by Perl's lower case modifiers and /+ (as |
| 7 |
|
|
used by pcretest), which is recognized and handled by the program. |
| 8 |
|
|
|
| 9 |
|
|
The data lines are processed as Perl double-quoted strings, so if they contain |
| 10 |
|
|
" \ $ or @ characters, these have to be escaped. For this reason, all such |
| 11 |
|
|
characters in testinput1 and testinput3 are escaped so that they can be used |
| 12 |
|
|
for perltest as well as for pcretest, and the special upper case modifiers such |
| 13 |
|
|
as /A that pcretest recognizes are not used in these files. The output should |
| 14 |
|
|
be identical, apart from the initial identifying banner. |
| 15 |
|
|
|
| 16 |
nigel |
63 |
The perltest script can also test UTF-8 features. It works as is for Perl 5.8 |
| 17 |
|
|
or higher. It recognizes the special modifier /8 that pcretest uses to invoke |
| 18 |
|
|
UTF-8 functionality. The testinput5 file can be fed to perltest to run UTF-8 |
| 19 |
|
|
tests. |
| 20 |
nigel |
49 |
|
| 21 |
nigel |
63 |
For Perl 5.6, perltest won't work unmodified for the UTF-8 tests. You need to |
| 22 |
|
|
uncomment the "use utf8" lines that it contains. It is best to do this on a |
| 23 |
|
|
copy of the script, because for non-UTF-8 tests, these lines should remain |
| 24 |
|
|
commented out. |
| 25 |
|
|
|
| 26 |
nigel |
41 |
The testinput2 and testinput4 files are not suitable for feeding to perltest, |
| 27 |
|
|
since they do make use of the special upper case modifiers and escapes that |
| 28 |
|
|
pcretest uses to test some features of PCRE. The first of these files also |
| 29 |
|
|
contains malformed regular expressions, in order to check that PCRE diagnoses |
| 30 |
nigel |
49 |
them correctly. Similarly, testinput6 tests UTF-8 features that do not relate |
| 31 |
|
|
to Perl. |
| 32 |
nigel |
41 |
|
| 33 |
|
|
Philip Hazel <ph10@cam.ac.uk> |
| 34 |
nigel |
63 |
August 2002 |