Part of the problem with have with 'Test::More' and friends is that there's not an easy way to attach diagnostics to any test. This is largely because the interface is set in stone. So I was thinking about a rewritten test interface which allows something like this (this code actually works, by the way):
use Test::Fluent 'no_plan'; my ( $have, $want ) = ( 1, 1 ); have $have, want $want, reason 'Some test name'; have [ 3, 4 ], want [ 4, 5 ], reason 'cuz I said so'; # fails true 3, reason '3 had better be true'; false 3, reason '3 had better still better be true'; # fails At the end of each of those, you could append a 'diagnostics' tag which is required to take a hashref: my $armageddon = $world->destruction; false $armaggedon, reason "World->destruction must never return true", diagnostic { world => $world }; I don't know that this is a brilliant interface, but just playing around with it works (the have/want pair automatically falls back to Test::Differences if $have or $want is a reference). It's a lot more explicit that Test::More and friends. That means it's a lot more verbose. However, it's something which could be played with. Is this a bad idea? Are there other suggestions people want? If we had a dot operator, it would be clean to write this: have($have).want($want).reason($some_reason); But we don't, so we'd have to fall back on the ugly: have($have)->want($want)->reason($some_reason); Though I could easily overload the dot operator to get the first syntax. Or if we needed delayed evaluation for some reason: have { $have }, want { $want }, reason $some_reason); That's also ugly and requires the (&) prototype (and friends). Thoughts? Am I totally smoking crack here? If there's a clean way to shoehorn diagnostics on the Test::More-style interface, I guess that would be ok. Cheers, Ovid -- Buy the book - http://www.oreilly.com/catalog/perlhks/ Tech blog - http://use.perl.org/~Ovid/journal/ Twitter - http://twitter.com/OvidPerl Official Perl 6 Wiki - http://www.perlfoundation.org/perl6