Commit | Line | Data |
60ffb308 |
1 | #!/usr/bin/perl -w |
2 | |
3 | # Testing to make sure Test::Builder doesn't accidentally store objects |
4 | # passed in as test arguments. |
5 | |
6 | BEGIN { |
7 | if( $ENV{PERL_CORE} ) { |
8 | chdir 't'; |
9 | @INC = '../lib'; |
10 | } |
11 | } |
12 | |
13 | use Test::More tests => 4; |
14 | |
15 | package Foo; |
16 | my $destroyed = 0; |
17 | sub new { bless {}, shift } |
18 | |
19 | sub DESTROY { |
20 | $destroyed++; |
21 | } |
22 | |
23 | package main; |
24 | |
25 | for (1..3) { |
26 | ok(my $foo = Foo->new, 'created Foo object'); |
27 | } |
28 | is $destroyed, 3, "DESTROY called 3 times"; |
29 | |