From 84bb2957796edcfae3987d615d1b8f0f6495a3cf Mon Sep 17 00:00:00 2001 From: Karl Williamson Date: Thu, 24 Jun 2010 11:00:06 -0600 Subject: [PATCH] Add tests for \400 for "" strings, s//replacement/ Signed-off-by: David Golden --- t/op/qq.t | 5 ++++- t/re/subst.t | 13 ++++++++++++- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/t/op/qq.t b/t/op/qq.t index 3a3108e..7b75b9b 100644 --- a/t/op/qq.t +++ b/t/op/qq.t @@ -5,7 +5,7 @@ BEGIN { @INC = '../lib'; } -print q(1..23 +print q(1..26 ); # This is() function is written to avoid "" @@ -61,6 +61,9 @@ is ("\x{000000000000000000000000000000000000000000000000000000000000000072}", is ("\x{0_06_5}", chr 101); is ("\x{1234}", chr 4660); is ("\x{10FFFD}", chr 1114109); +is ("\400", chr 0x100); +is ("\600", chr 0x180); +is ("\777", chr 0x1FF); # These kludged tests should change when we remove the temporary fatal error # in util.c for "\c{". And, the warning there should probably not be diff --git a/t/re/subst.t b/t/re/subst.t index 73c7ac0..de6284a 100644 --- a/t/re/subst.t +++ b/t/re/subst.t @@ -7,7 +7,7 @@ BEGIN { } require './test.pl'; -plan( tests => 167 ); +plan( tests => 170 ); # Stolen from re/ReTest.pl. Can't just use the file since it doesn't support # like() and it conflicts with test.pl @@ -713,3 +713,14 @@ fresh_perl_is( '$_="abcef"; s/bc|(.)\G(.)/$1 ? "[$1-$2]" : "XX"/ge; print' => 'a is($non_sub_string, $string, "Verify that failed substitute doesn't change string"); } + +{ # Verify largish octal in replacement pattern + + my $string = "a"; + $string =~ s/a/\400/; + is($string, chr 0x100, "Verify that handles s/foo/\\400/"); + $string =~ s/./\600/; + is($string, chr 0x180, "Verify that handles s/foo/\\600/"); + $string =~ s/./\777/; + is($string, chr 0x1FF, "Verify that handles s/foo/\\777/"); +} -- 1.8.3.1