This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Brendan Byrd is now a perl AUTHOR
[perl5.git] / ext / arybase / t / scope.t
1 use warnings; no warnings 'deprecated';
2 use strict;
3
4 use Test::More tests => 14;
5
6 our @t = qw(a b c d e f);
7
8 is $t[3], "d";
9 $[ = 3;
10 is $t[3], "a";
11 {
12         is $t[3], "a";
13         $[ = -1;
14         is $t[3], "e";
15         $[ = +0;
16         is $t[3], "d";
17         $[ = +1;
18         is $t[3], "c";
19         $[ = 0;
20         is $t[3], "d";
21 }
22 is $t[3], "a";
23 {
24         local $[ = -1;
25         is $t[3], "e";
26 }
27 is $t[3], "a";
28 {
29         ($[) = -1;
30         is $t[3], "e";
31 }
32 is $t[3], "a";
33 use t::scope_0;
34 is scope0_test(), "d";
35
36
37 is eval(q{
38         $[ = 3;
39         BEGIN { my $x = "foo\x{666}"; $x =~ /foo\p{Alnum}/; }
40         $t[3];
41 }), "a";
42
43 1;