From 410a87cf53faefde0612c4b86b028c140c5884fe Mon Sep 17 00:00:00 2001 From: Karl Williamson Date: Tue, 10 Mar 2015 14:53:05 -0600 Subject: [PATCH] dist/Safe/t/safeutf8.t: Fix to work on early Perls In commit fedc1b0e2d9cec34b7e3b1fa65dd0f7eb4f539fd, I forgot that this is dual-lifed and may be used on early Perls. This commit allows that, but it will fail if such a Perl were to be used on an EBCDIC platform. --- dist/Safe/t/safeutf8.t | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/dist/Safe/t/safeutf8.t b/dist/Safe/t/safeutf8.t index 6521c9c..9a87aa9 100644 --- a/dist/Safe/t/safeutf8.t +++ b/dist/Safe/t/safeutf8.t @@ -21,7 +21,12 @@ $safe->deny_only(); # Expression that triggers require utf8 and call to SWASHNEW. # Fails with "Undefined subroutine PLPerl::utf8::SWASHNEW called" # if SWASHNEW is not shared, else returns true if unicode logic is working. -my $trigger = q{ my $a = pack('U',0xC4); my $b = chr utf8::unicode_to_native(0xE4); utf8::upgrade $b; $a =~ /$b/i }; +# (For early Perls we don't take into account EBCDIC, so will fail there +my $trigger = q{ my $a = pack('U',0xC4); my $b = chr } + . (($] lt 5.007_003) ? "" : 'utf8::unicode_to_native(') + . '0xE4' + . (($] lt 5.007_003) ? "" : ')') + . q{; utf8::upgrade $b; $a =~ /$b/i }; ok $safe->reval( $trigger ), 'trigger expression should return true'; is $@, '', 'trigger expression should not die'; -- 1.8.3.1