From: Nicholas Clark Date: Sat, 28 Feb 2015 15:24:13 +0000 (+0100) Subject: Use formline for creating an OOK scalar to test. X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=00a70dfae49af9794176b7a836c5e9583e0bb398;p=p5sagit%2FDevel-Size.git Use formline for creating an OOK scalar to test. As of 5.20.0, s/// no longer reliably triggers OOK, as COW is enabled. Thanks to Niko Tyni for diagnosing the cause of the test failure. CPAN #95493 --- diff --git a/CHANGES b/CHANGES index 58fb29a..44d0da6 100644 --- a/CHANGES +++ b/CHANGES @@ -1,6 +1,7 @@ Revision history for Perl extension Devel::Size. 0.79_51 2015-02-28 nicholas + * as of 5.20.0, s/// is no longer a reliable test for OOK [CPAN #95493] 0.79_50 2015-02-28 nicholas patches from Zefram: diff --git a/t/basic.t b/t/basic.t index b544ebf..f337a5e 100644 --- a/t/basic.t +++ b/t/basic.t @@ -118,7 +118,10 @@ foreach(['undef', total_size(undef)], my $before_size = total_size($uurk); my $before_length = length $uurk; cmp_ok($before_size, '>', $before_length, 'Size before is sane'); - $uurk =~ s/Perl //; + # As of 5.20.0, s/// doesn't trigger COW. + # Seems that formline is about the the only thing left that reliably calls + # sv_chop. See CPAN #95493, perl #122322 + formline '^<<<<~', $uurk; is(total_size($uurk), $before_size, "Size doesn't change because OOK is used"); cmp_ok(length $uurk, '<', $before_size, 'but string is shorter');