1N/A# Each line in that file is a separate test. 1N/A# There are five columns, separated by tabs. 1N/A# Column 1 contains the pattern, optionally enclosed in C<''>. 1N/A# Modifiers can be put after the closing C<'>. 1N/A# Column 2 contains the string to be matched. 1N/A# Column 3 contains the expected result: 1N/A# B test exposes a known bug in Perl, should be skipped 1N/A# b test exposes a known bug in Perl, should be skipped if noamp 1N/A# Columns 4 and 5 are used only if column 3 contains C<y> or C<c>. 1N/A# Column 4 contains a string, usually C<$&>. 1N/A# Column 5 contains the expected result of double-quote 1N/A# interpolating that string after the match, or start of error message. 1N/A# Column 6, if present, contains a reason why the test is skipped. 1N/A# This is printed with "skipped", for harness to pick up. 1N/A# \n in the tests are interpolated, as are variables of the form ${\w+}. 1N/A# If you want to add a regular expression test that can't be expressed 1N/A# in this format, don't add it here: put it in op/pat.t instead. 1N/A chdir 't' if -d 't'; 1N/A$iters =
shift ||
1;
# Poor man performance suite, 10000 is OK. 1N/A $pat =~ s/(\$\{\w+\})/$1/eeg; 1N/A $subject =~ s/(\$\{\w+\})/$1/eeg; 1N/A $subject =~ s/\\n/\n/g; 1N/A $expect =~ s/(\$\{\w+\})/$1/eeg; 1N/A $expect =~ s/\\n/\n/g; 1N/A $expect = $repl = '-' if $skip_amp and $input =~ /\$[&\`\']/; 1N/A $skip = ($skip_amp ? ($result =~ s/B//i) : ($result =~ s/B//)); 1N/A $result =~ s/B//i unless $skip; 1N/A eval "$study; \$match = (\$subject =~ m$pat) while \$c--; \$got = \"$repl\";"; 1N/A if ($result eq 'c') { 1N/A if ($err !~ m!^\Q$expect!) { print "not ok $. (compile) $input => `$err'\n"; next TEST } 1N/A last; # no need to study a syntax error 1N/A print "ok $. # skipped", length($reason) ? " $reason" : '', "\n"; 1N/A elsif ($result eq 'n') { 1N/A if ($match) { print "not ok $. ($study) $input => false positive\n"; next TEST } 1N/A if (!$match || $got ne $expect) { 1N/Asub infty_subst # Special-case substitution