Refactor 3 tests so that they avoid clearing %:: via list assignment.
authorNicholas Clark <nick@ccl4.org>
Wed, 10 Apr 2013 11:44:07 +0000 (13:44 +0200)
committerNicholas Clark <nick@ccl4.org>
Tue, 21 May 2013 10:09:09 +0000 (12:09 +0200)
For all 3, clearing %:: was intended to expose another bug, not to directly
test the effects of clearing %::

Tested by building the 3 revisions that added the tests, and confirming that
the revised test also triggers the bug that each fixed.

t/op/stash.t

index fd5450e..2681d47 100644 (file)
@@ -11,7 +11,7 @@ plan( tests => 58 );
 
 # Used to segfault (bug #15479)
 fresh_perl_like(
-    '%:: = ""',
+    'delete $::{STDERR}; my %a = ""',
     qr/Odd number of elements in hash assignment at - line 1\./,
     { switches => [ '-w' ] },
     'delete $::{STDERR} and print a warning',
@@ -59,14 +59,15 @@ package main;
 {
     local $ENV{PERL_DESTRUCT_LEVEL} = 2;
     fresh_perl_is(
-                 'package A; sub a { // }; %::=""',
+                 'package A::B; sub a { // }; %A::=""',
                  '',
                  '',
                  );
     # Variant of the above which creates an object that persists until global
-    # destruction.
+    # destruction, and triggers an assertion failure prior to change
+    # a420522db95b7762
     fresh_perl_is(
-                 'use Exporter; package A; sub a { // }; %::=""',
+                 'use Exporter; package A; sub a { // }; delete $::{$_} for keys %::',
                  '',
                  '',
                  );