a[b-d] aac y $& ac
a[-b] a- y $& a-
a[b-] a- y $& a-
-a[b-a] - c - Invalid [] range "b-a"
+a[b-a] - c - Invalid [] range \"b-a\"
a[]b - c - Unmatched [
a[ - c - Unmatched [
a] a] y $& a]
a\(b a(b y $&-$1 a(b-
a\(*b ab y $& ab
a\(*b a((b y $& a((b
-a\\b a\b y $& a\b
+a\\b a\\b y $& a\\b
abc) - c - Unmatched )
(abc - c - Unmatched (
((a)) abc y $&-$1-$2 a-a-a
(.*)c(.*) abcde y $&-$1-$2 abcde-ab-de
\((.*), (.*)\) (a, b) y ($2, $1) (b, a)
[k] ab n - -
-abcd abcd y $&-\$&-\\$& abcd-$&-\abcd
-a(bc)d abcd y $1-\$1-\\$1 bc-$1-\bc
+abcd abcd y $&-\$&-\\$& abcd-\$&-\\abcd
+a(bc)d abcd y $1-\$1-\\$1 bc-\$1-\\bc
a[-]?c ac y $& ac
(abc)\1 abcabc y $1 abc
([a-c]*)\1 abcabc y $1 abc
'a[b-d]'i AAC y $& AC
'a[-b]'i A- y $& A-
'a[b-]'i A- y $& A-
-'a[b-a]'i - c - Invalid [] range "b-a"
+'a[b-a]'i - c - Invalid [] range \"b-a\"
'a[]b'i - c - Unmatched [
'a['i - c - Unmatched [
'a]'i A] y $& A]
'a\(b'i A(B y $&-$1 A(B-
'a\(*b'i AB y $& AB
'a\(*b'i A((B y $& A((B
-'a\\b'i A\B y $& A\B
+'a\\b'i A\\B y $& A\\B
'abc)'i - c - Unmatched )
'(abc'i - c - Unmatched (
'((a))'i ABC y $&-$1-$2 A-A-A
'(.*)c(.*)'i ABCDE y $&-$1-$2 ABCDE-AB-DE
'\((.*), (.*)\)'i (A, B) y ($2, $1) (B, A)
'[k]'i AB n - -
-'abcd'i ABCD y $&-\$&-\\$& ABCD-$&-\ABCD
-'a(bc)d'i ABCD y $1-\$1-\\$1 BC-$1-\BC
+'abcd'i ABCD y $&-\$&-\\$& ABCD-\$&-\\ABCD
+'a(bc)d'i ABCD y $1-\$1-\\$1 BC-\$1-\\BC
'a[-]?c'i AC y $& AC
'(abc)\1'i ABCABC y $1 ABC
'([a-c]*)\1'i ABCABC y $1 ABC
#
# If you want to add a regular expression test that can't be expressed
# in this format, don't add it here: put it in op/pat.t instead.
+#
+# Note that columns 2,3 and 5 are all enclosed in double quotes and then
+# evalled; so something like a\"\x{100}$1 has length 3+length($1).
BEGIN {
chdir 't' if -d 't';
$pat = "'$pat'" unless $pat =~ /^[:']/;
$pat =~ s/(\$\{\w+\})/$1/eeg;
$pat =~ s/\\n/\n/g;
- $subject =~ s/(\$\{\w+\})/$1/eeg;
- $subject =~ s/\\n/\n/g;
- $expect =~ s/(\$\{\w+\})/$1/eeg;
- $expect =~ s/\\n/\n/g;
+ $subject = eval qq("$subject");
+ $expect = eval qq("$expect");
$expect = $repl = '-' if $skip_amp and $input =~ /\$[&\`\']/;
$skip = ($skip_amp ? ($result =~ s/B//i) : ($result =~ s/B//));
$reason = 'skipping $&' if $reason eq '' && $skip_amp;