]> git.vpit.fr Git - perl/modules/Scope-Upper.git/blob - t/36-localize_elem-numerous.t
fix unwind()
[perl/modules/Scope-Upper.git] / t / 36-localize_elem-numerous.t
1 #!perl -T
2
3 use strict;
4 use warnings;
5
6 my $n;
7 BEGIN { $n = 1000; }
8
9 use Test::More tests => 3;
10
11 use Scope::Upper qw<localize_elem UP>;
12
13 our @A = ((0) x $n);
14
15 sub setup {
16  for (reverse 0 .. ($n-1)) {
17   localize_elem '@A', $_ => ($_ + 1) => UP UP;
18  }
19 }
20
21 is_deeply  \@A, [ (0) x $n ], '@A was correctly initialized';
22 {
23  setup;
24  is_deeply \@A, [ 1 .. $n ],  '@A elements are correctly localized';
25 }
26 is_deeply  \@A, [ (0) x $n ], '@A regained its original elements';