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 6BEGIN { 7 if( $ENV{PERL_CORE} ) { 8 chdir 't'; 9 @INC = '../lib'; 10 } 11} 12 13use Test::More tests => 4; 14 15package Foo; 16my $destroyed = 0; 17sub new { bless {}, shift } 18 19sub DESTROY { 20 $destroyed++; 21} 22 23package main; 24 25for (1..3) { 26 ok(my $foo = Foo->new, 'created Foo object'); 27} 28is $destroyed, 3, "DESTROY called 3 times"; 29 30