]> git.vpit.fr Git - perl/modules/Scope-Upper.git/blob - t/16-reap-numerous.t
fix unwind()
[perl/modules/Scope-Upper.git] / t / 16-reap-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 => $n;
10
11 use Scope::Upper qw<reap UP>;
12
13 my $count;
14
15 sub setup {
16  for my $i (reverse 1 .. $n) {
17   reap {
18    is $count, $i, "$i-th destructor called at the right time";
19    ++$count;
20   } UP UP;
21  }
22 }
23
24 $count = $n + 1;
25
26 {
27  setup;
28  $count = 1;
29 }