From e1b145039d15f6202e21cd23abb95117153eb816 Mon Sep 17 00:00:00 2001 From: Father Chrysostomos Date: Mon, 26 Nov 2012 09:40:34 -0800 Subject: [PATCH] subst.t: Test something I nearly broke MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit The saving and restoring of $@ when utf8 tables were looked up was causing pp_subst’s string pointers to go stale. The existing mechanism of copying it temporarily to another scalar was already very fragile, and the new COW mechanism broke it (but I fixed it in the same commit that introduced the new COW mechanism). --- t/re/subst.t | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/t/re/subst.t b/t/re/subst.t index b139812..8acd54f 100644 --- a/t/re/subst.t +++ b/t/re/subst.t @@ -7,7 +7,7 @@ BEGIN { require './test.pl'; } -plan( tests => 205 ); +plan( tests => 206 ); $_ = 'david'; $a = s/david/rules/r; @@ -881,3 +881,8 @@ $a = ""; utf8::upgrade $a; $_ =~ s/$/$a/; is $_, "\xc4\x80", "empty utf8 repl does not result in mangled utf8"; + +$@ = "\x{30cb}eval 18"; +$@ =~ s/eval \d+/eval 11/; +is $@, "\x{30cb}eval 11", + 'loading utf8 tables does not interfere with matches against $@'; -- 2.7.4