Gabor Szabo <[email protected]> writes:
> With the obvious risk of being laughed at, I'd like to ask
> you guys for a good use-case of isnt() in Test::More.
What's "good"? Anyway ...
I've used it testing that objects are clones and not copies:
# quick and dirty:
isnt( $clone, $original, 'Not a copy' );
# more SWYM, but requires that the objects know who they are:
isnt( $clone->Id, $original->Id, 'Not a copy' );
Or testing that generator or iterator functions do not keep
returning the same item:
isnt( func(), func(), 'Got a new one' );
Or testing that two structures differ where I expect them to:
my $foo = delete $foo{baz};
my $bar = delete $bar{baz};
isnt( $foo, $bar, 'Hashes differ in the baz key ...' );
is_deeply( \%foo, \%bar, '... but are otherwise equal.' );
And of course, I used it to implement &Test::Trap::return_isnt,
&Test::Trap::exit_isnt, &Test::Trap::stdout_isnt, etc. Which returns
us to the "what's good" question. ;-)
Eirik
--
The basic facts are that the rate of decrease of the population growth
rate has been falling for decades, at an ever increasing rate.
[email protected] (John R. Snead)