Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re^2: When test-driven development just won't do

by xdg (Monsignor)
on Aug 04, 2005 at 13:53 UTC ( #480824=note: print w/replies, xml ) Need Help??


in reply to Re: When test-driven development just won't do
in thread When test-driven development just won't do

For random number generation:

For garbage collection, if you really want to do this, why not install your own UNIVERSAL::DESTROY subroutine during testing:

use strict; use warnings; package Foo; sub new { return bless {} } package main; use Test::More tests => 3; my %destroyed; $destroyed{Foo} = 0; { no strict 'refs'; *{"UNIVERSAL::DESTROY"} = sub { $destroyed{ref(shift)}++ }; } my $obj1 = Foo->new; my $obj2 = Foo->new; is( $destroyed{Foo}, 0, "Nothing destroyed yet" ); $obj1 = undef; is( $destroyed{Foo}, 1, "Destroyed 1" ); $obj2 = undef; is( $destroyed{Foo}, 2, "Destroyed 2" ); __END__ 1..3 ok 1 - Nothing destroyed yet ok 2 - Destroyed 1 ok 3 - Destroyed 2

-xdg

Code written by xdg and posted on PerlMonks is public domain. It is provided as is with no warranties, express or implied, of any kind. Posted code may not have been tested. Use of posted code is at your own risk.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://480824]
help
Chatterbox?
[Eily]: you should use DC instead, less variation
[Discipulus]: surprisingly i put ADCD in this precise moment!
[GotToBTru]: ACDC can provide some clarity at times

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (7)
As of 2017-06-26 11:39 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    How many monitors do you use while coding?















    Results (577 votes). Check out past polls.