This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
RMG: fix typo, clarify instructions a bit
[perl5.git] / t / op / substr.t
index 0bfdfb3..eae2403 100644 (file)
@@ -5,8 +5,7 @@
 BEGIN {
     chdir 't' if -d 't';
     require './test.pl';
-    @INC = () unless is_miniperl();
-    unshift @INC, '../lib';
+    set_up_inc('../lib');
 }
 use warnings ;
 
@@ -23,7 +22,7 @@ $SIG{__WARN__} = sub {
      }
 };
 
-plan(387);
+plan(388);
 
 run_tests() unless caller;
 
@@ -684,6 +683,13 @@ is($x, "\x{100}\x{200}\xFFb");
     }
 }
 
+# Also part of perl #24346; scalar(substr...) should not affect lvalueness
+{
+    my $str = "abcdef";
+    sub { $_[0] = 'dea' }->( scalar substr $str, 3, 2 );
+    is $str, 'abcdeaf', 'scalar does not affect lvalueness of substr';
+}
+
 # [perl #24200] string corruption with lvalue sub
 
 {
@@ -708,6 +714,7 @@ is($x, "\x{100}\x{200}\xFFb");
 # [perl #23765]
 {
     my $a = pack("C", 0xbf);
+    no warnings 'deprecated';
     substr($a, -1) &= chr(0xfeff);
     is($a, "\xbf");
 }