File: 46-localize_delete-numerous.t

package info (click to toggle)
libscope-upper-perl 0.12-1
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 312 kB
  • ctags: 16
  • sloc: perl: 2,831; makefile: 7
file content (26 lines) | stat: -rw-r--r-- 433 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#!perl -T

use strict;
use warnings;

my $n;
BEGIN { $n = 1000; }

use Test::More tests => 3;

use Scope::Upper qw/localize_delete UP/;

our @A = (1 .. $n);

sub setup {
 for (reverse 0 .. ($n-1)) {
  localize_delete '@A', $_ => UP UP;
 }
}

is_deeply  \@A, [ 1 .. $n ], '@A was correctly initialized';
{
 setup;
 is_deeply \@A, [ ],         '@A is empty inside the block';
}
is_deeply  \@A, [ 1 .. $n ], '@A regained its elements';