Fix test for overload in given() with smart match after last change
[p5sagit/p5-mst-13.2.git] / t / op / substr.t
index 40f8766..c3fa6e1 100755 (executable)
@@ -1,4 +1,4 @@
-#!./perl -w
+#!./perl
 
 #P = start of string  Q = start of substr  R = end of substr  S = end of string
 
@@ -7,6 +7,7 @@ BEGIN {
     @INC = '../lib';
 }
 use warnings ;
+no warnings 'deprecated';
 
 $a = 'abcdefxyz';
 $SIG{__WARN__} = sub {
@@ -25,6 +26,12 @@ require './test.pl';
 
 plan(334);
 
+run_tests() unless caller;
+
+my $krunch = "a";
+
+sub run_tests {
+
 $FATAL_MSG = qr/^substr outside of string/;
 
 is(substr($a,0,3), 'abc');   # P=Q R S
@@ -643,11 +650,10 @@ is($x, "\x{100}\x{200}\xFFb");
 # [perl #24200] string corruption with lvalue sub
 
 {
-    my $foo = "a";
-    sub bar: lvalue { substr $foo, 0 }
+    sub bar: lvalue { substr $krunch, 0 }
     bar = "XXX";
     is(bar, 'XXX');
-    $foo = '123456789';
+    $krunch = '123456789';
     is(bar, '123456789');
 }
 
@@ -675,3 +681,5 @@ is($x, "\x{100}\x{200}\xFFb");
     is(substr($a,1,2), 'bc');
     is(substr($a,1,1), 'b');
 }
+
+}