summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorRafael Garcia-Suarez <rgarciasuarez@gmail.com>2002-12-12 20:35:29 +0000
committerRafael Garcia-Suarez <rgarciasuarez@gmail.com>2002-12-12 20:35:29 +0000
commitf14c76ed18fcf3fc609cea29294703220581a43a (patch)
treea9f2029f27c012fcaf665e055fb0515058f78bed /t
parent7e107e90b7bd52c7fb110ac98da6bb7ab38e8959 (diff)
downloadperl-f14c76ed18fcf3fc609cea29294703220581a43a.tar.gz
Integrate from maint-5.8 : changes 18290-1, 18293-5, 18297
p4raw-id: //depot/perl@18299 p4raw-integrated: from //depot/maint-5.8/perl@18298 'copy in' pod/perlretut.pod (@17645..) pod/perlre.pod (@18080..) ext/POSIX/t/is.t (@18189..) t/op/subst.t (@18214..) ext/POSIX/t/posix.t (@18271..) t/op/pat.t (@18276..) ext/POSIX/POSIX.pod (@18294..) 'merge in' regexec.c (@18095..)
Diffstat (limited to 't')
-rwxr-xr-xt/op/pat.t53
-rwxr-xr-xt/op/subst.t16
2 files changed, 64 insertions, 5 deletions
diff --git a/t/op/pat.t b/t/op/pat.t
index 20763e4ef9..62520dda6b 100755
--- a/t/op/pat.t
+++ b/t/op/pat.t
@@ -6,7 +6,7 @@
$| = 1;
-print "1..942\n";
+print "1..968\n";
BEGIN {
chdir 't' if -d 't';
@@ -3006,4 +3006,53 @@ print "\x{072F}" =~ /\P{Syriac1}/ ? "ok $test\n" : "not ok $test\n"; $test++;
++$test;
}
-# last test 942
+{
+ print "# [perl #15763]\n";
+
+ $a = "x\x{100}";
+ chop $a; # but leaves the UTF-8 flag
+ $a .= "y"; # 1 byte before "y"
+
+ ok($a =~ /^\C/, 'match one \C on 1-byte UTF-8');
+ ok($a =~ /^\C{1}/, 'match \C{1}');
+
+ ok($a =~ /^\Cy/, 'match \Cy');
+ ok($a =~ /^\C{1}y/, 'match \C{1}y');
+
+ $a = "\x{100}y"; # 2 bytes before "y"
+
+ ok($a =~ /^\C/, 'match one \C on 2-byte UTF-8');
+ ok($a =~ /^\C{1}/, 'match \C{1}');
+ ok($a =~ /^\C\C/, 'match two \C');
+ ok($a =~ /^\C{2}/, 'match \C{2}');
+
+ ok($a =~ /^\C\C\C/, 'match three \C on 2-byte UTF-8 and a byte');
+ ok($a =~ /^\C{3}/, 'match \C{3}');
+
+ ok($a =~ /^\C\Cy/, 'match two \C');
+ ok($a =~ /^\C{2}y/, 'match \C{2}');
+
+ ok($a !~ /^\C\C\Cy/, 'not match three \Cy');
+ ok($a !~ /^\C{2}\Cy/, 'not match \C{3}y');
+
+ $a = "\x{1000}y"; # 3 bytes before "y"
+
+ ok($a =~ /^\C/, 'match one \C on three-byte UTF-8');
+ ok($a =~ /^\C{1}/, 'match \C{1}');
+ ok($a =~ /^\C\C/, 'match two \C');
+ ok($a =~ /^\C{2}/, 'match \C{2}');
+ ok($a =~ /^\C\C\C/, 'match three \C');
+ ok($a =~ /^\C{3}/, 'match \C{3}');
+
+ ok($a =~ /^\C\C\C\C/, 'match four \C on three-byte UTF-8 and a byte');
+ ok($a =~ /^\C{4}/, 'match \C{4}');
+
+ ok($a =~ /^\C\C\Cy/, 'match three \Cy');
+ ok($a =~ /^\C{3}y/, 'match \C{3}y');
+
+ ok($a !~ /^\C\C\C\C\y/, 'not match four \Cy');
+ ok($a !~ /^\C{4}y/, 'not match \C{4}y');
+}
+
+# last test 968
+
diff --git a/t/op/subst.t b/t/op/subst.t
index ef0ae0a064..797f24139b 100755
--- a/t/op/subst.t
+++ b/t/op/subst.t
@@ -7,7 +7,7 @@ BEGIN {
}
require './test.pl';
-plan( tests => 124 );
+plan( tests => 125 );
$x = 'foo';
$_ = "x";
@@ -494,9 +494,19 @@ SKIP: {
$_ = 'aaaa';
$r = 'x';
$s = s/a(?{})/$r/g;
-is("<$_> <$s>", "<xxxx> <4>", "perl #7806");
+is("<$_> <$s>", "<xxxx> <4>", "[perl #7806]");
$_ = 'aaaa';
$s = s/a(?{})//g;
-is("<$_> <$s>", "<> <4>", "perl #7806");
+is("<$_> <$s>", "<> <4>", "[perl #7806]");
+# [perl #19048] Coredump in silly replacement
+{
+ local $^W = 0;
+ $_="abcdef\n";
+ s!.!!eg;
+ is($_, "\n", "[perl #19048]");
+}
+
+
+