]> git.vpit.fr Git - perl/modules/Scope-Upper.git/blobdiff - t/16-reap-numerous.t
Fix numerous localizations in the same scope not happening
[perl/modules/Scope-Upper.git] / t / 16-reap-numerous.t
diff --git a/t/16-reap-numerous.t b/t/16-reap-numerous.t
new file mode 100644 (file)
index 0000000..d876e07
--- /dev/null
@@ -0,0 +1,29 @@
+#!perl -T
+
+use strict;
+use warnings;
+
+my $n;
+BEGIN { $n = 1000; }
+
+use Test::More tests => $n;
+
+use Scope::Upper qw/reap UP/;
+
+my $count;
+
+sub setup {
+ for my $i (reverse 1 .. $n) {
+  reap {
+   is $count, $i, "$i-th destructor called at the right time";
+   ++$count;
+  } UP UP;
+ }
+}
+
+$count = $n + 1;
+
+{
+ setup;
+ $count = 1;
+}