t/op/append.t See if . works
t/op/args.t See if operations on @_ work
t/op/arith.t See if arithmetic works
+t/op/array_base.t Tests for the $[, which is deprecated
t/op/array.t See if array operations work
t/op/assignwarn.t See if OP= operators warn correctly for undef targets
t/op/attrhand.t See if attribute handlers work
# Checks if the parser behaves correctly in edge cases
# (including weird syntax errors)
-print "1..112\n";
+print "1..104\n";
sub failed {
my ($got, $expected, $name) = @_;
like( $@, qr/syntax error/, "use without body" );
}
-# Bug #27024
-{
- # this used to segfault (because $[=1 is optimized away to a null block)
- my $x;
- $[ = 1 while $x;
- $test = $test + 1;
- print "ok $test\n";
- $[ = 0; # restore the original value for less side-effects
-}
-
# [perl #2738] perl segfautls on input
{
eval q{ sub _ <> {} };
like($@, qr/Illegal declaration of subroutine main::_/, "__FILE__ as prototype");
}
-# [perl #36313] perl -e "1for$[=0" crash
-{
- my $x;
- $x = 1 for ($[) = 0;
- $test = $test + 1;
- print "ok $test - optimized assignment to \$[ used to segfault in list context\n";
- if ($[ = 0) { $x = 1 }
- $test = $test + 1;
- print "ok $test - optimized assignment to \$[ used to segfault in scalar context\n";
- $x = ($[=2.4);
- is($x, 2, 'scalar assignment to $[ behaves like other variables');
- $x = (($[) = 0);
- is($x, 1, 'list assignment to $[ behaves like other variables');
- $x = eval q{ ($[, $x) = (0) };
- like($@, qr/That use of \$\[ is unsupported/,
- 'cannot assign to $[ in a list');
- eval q{ ($[) = (0, 1) };
- like($@, qr/That use of \$\[ is unsupported/,
- 'cannot assign list of >1 elements to $[');
- eval q{ ($[) = () };
- like($@, qr/That use of \$\[ is unsupported/,
- 'cannot assign list of <1 elements to $[');
-}
-
# tests for "Bad name"
eval q{ foo::$bar };
like( $@, qr/Bad name after foo::/, 'Bad name after foo::' );
--- /dev/null
+#!perl -w
+use strict;
+
+require './test.pl';
+
+plan (tests => 8);
+no warnings 'deprecated';
+
+# Bug #27024
+{
+ # this used to segfault (because $[=1 is optimized away to a null block)
+ my $x;
+ $[ = 1 while $x;
+ pass('#27204');
+ $[ = 0; # restore the original value for less side-effects
+}
+
+# [perl #36313] perl -e "1for$[=0" crash
+{
+ my $x;
+ $x = 1 for ($[) = 0;
+ pass('optimized assignment to $[ used to segfault in list context');
+ if ($[ = 0) { $x = 1 }
+ pass('optimized assignment to $[ used to segfault in scalar context');
+ $x = ($[=2.4);
+ is($x, 2, 'scalar assignment to $[ behaves like other variables');
+ $x = (($[) = 0);
+ is($x, 1, 'list assignment to $[ behaves like other variables');
+ $x = eval q{ ($[, $x) = (0) };
+ like($@, qr/That use of \$\[ is unsupported/,
+ 'cannot assign to $[ in a list');
+ eval q{ ($[) = (0, 1) };
+ like($@, qr/That use of \$\[ is unsupported/,
+ 'cannot assign list of >1 elements to $[');
+ eval q{ ($[) = () };
+ like($@, qr/That use of \$\[ is unsupported/,
+ 'cannot assign list of <1 elements to $[');
+}