This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Follow-up on a149d118.
[perl5.git] / t / op / array_base.t
1 #!perl -w
2 use strict;
3
4 BEGIN {
5  chdir 't' if -d 't';
6  require './test.pl';
7
8  plan (tests => my $tests = 11);
9
10  # Run these at BEGIN time, before arybase loads
11  use v5.15;
12  is(eval('$[ = 1; 123'), undef);
13  like($@, qr/\AAssigning non-zero to \$\[ is no longer possible/);
14
15  if (is_miniperl()) {
16    # skip the rest
17    SKIP: { skip ("no arybase.xs on miniperl", $tests-2) }
18    exit;
19  }
20 }
21
22 no warnings 'deprecated';
23
24 is(eval('$['), 0);
25 is(eval('$[ = 0; 123'), 123);
26 is(eval('$[ = 1; 123'), 123);
27 $[ = 1;
28 ok $INC{'arybase.pm'};
29
30 use v5.15;
31 is(eval('$[ = 1; 123'), undef);
32 like($@, qr/\AAssigning non-zero to \$\[ is no longer possible/);
33 is $[, 0, '$[ is 0 under 5.16';
34 $_ = "hello";
35 /l/g;
36 my $pos = \pos;
37 is $$pos, 3;
38 $$pos = 1;
39 is $$pos, 1;
40
41 1;