]> git.vpit.fr Git - perl/modules/Scope-Upper.git/blobdiff - t/46-localize_delete-numerous.t
Fix numerous localizations in the same scope not happening
[perl/modules/Scope-Upper.git] / t / 46-localize_delete-numerous.t
diff --git a/t/46-localize_delete-numerous.t b/t/46-localize_delete-numerous.t
new file mode 100644 (file)
index 0000000..183dadc
--- /dev/null
@@ -0,0 +1,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';