On Thu, Apr 04, 2002 at 12:01:45PM +0100, Mark Fowler wrote:
> Firstly, is there anyway we could get Test::Builder's diag (and thus
> Test::More's) diag to return false not true like it currently does.
>
> This would then allow me to write simply
>
> sub is_reversed
> {
> return $Tester->ok($_[0] eq reverse($_[1]))
> or $Tester->diag("The reverse of '$_[0]' is '".reversed($_[0]).
> "' not '$_[1]' as expected")
> }
>
> rather than having to do the horrible "&& 0" at the end to ensure that
> the method returns the correct truth (otherwise is_reversed will return
> true no matter what is called)
Sensible. Done. If anyone asks, it's your fault.
> Secondly, I was wondering about eq_set in Test::More.
>
> ok(eq_set([1,1,1],[1]));
>
> fails, where really it should work as sets don't care about reoccurring
> elements. Should this be 'eq_bag' instead?
eq_set() is really just because I got sick of writing:
eq_array([sort @something], [sort @something_else]);
wasn't really thinking about Set Theory at the time. So yes, eq_set()
would probably be better as eq_bag() or something. But we can't
change the name now.
However, the eq_* functions are largely discouraged because they can't
produce intellegent diagnostics. If any new complex data structure
comparison utilites were added I'd rather go the is_deeply() route.
And all that stuff needs to be moved into Test::Builder anyway. Can
'o worms.
As for Test::More, don't think I'll be taking any new functions. The
interface is already too big. But the deep data structure
functionality isn't really complete.
I'd encourage you to write a Test::Builder based module that does more
complete set & complex data testing. Either talk to Barrie about
adding it to Test::Differences or start a new module. Test::Set,
Test::Data::Deep, etc...
--
Michael G. Schwern <[EMAIL PROTECTED]> http://www.pobox.com/~schwern/
Perl Quality Assurance <[EMAIL PROTECTED]> Kwalitee Is Job One
Lesbian lovers
return to fourth grade slogans
EAT SOME PASTE, they cry
sobbing lesbian
excluded from the party
allergic to wheat
-- mjd