Adrian Howard wrote: > 2) Much of the value from Perl's test frameworks come from the stupid > number of useful testing modules that work happily with each other. I > can just pick Test::WWW::Mechanise (or whatever) off the shelf and use > it with the rest of the testing framework. > > It's going to be harder for folk to adopt you approach because you don't > directly support using the testing functions that other Test::* > libraries provide. I'll have to do a fair amount of work to use > Test::WWW::Mechanize or Test::BinaryData inside a comparison function. A > standard way to wrap "normal" test functions would be useful.
Through the magic of Test::Builder there's no need to cram everything into a comparison function. They can live side by side. #!/usr/bin/perl -w use Test::Functional; use Test::More; test { 2 * 2 } eqv(4), "functional"; is 2 * 2, 4, "moreish"; done_testing(); If you really want to there's an example in the docs about turning normal testing functions into comparitors, though the docs are not really the correct way to do it. What you want is to curry them, which is what all Test::Functional's internal comparitors do. use Test::Functional; use Test::BinaryData; use Sub::Curry qw(curry HOLE); sub cmp_binary { # Sure, you could do this by hand, but why? return curry \&is_binary, HOLE, shift; } test { "blah blah" } cmp_binary("blah blah"), "on off curry"; done_testing(); Though honestly I don't see what's been won. use Test::BinaryData; is_binary("blah blah", "blah blah", "its even shorter"); At best you have the ability to group statements together into a test, but I already have that without any intervening pseudo-block to get in the way of debugging. # I can even name the block { my $binary = read_some_binary($file); is_binary($binary, "blah blah", "no module required"); } Though one can argue that this is only because all the testing functions are written as testing functions and not comparitors. I like the direction, but it needs to show an advantage beyond a thick crusting of sugar. -- I am somewhat preoccupied telling the laws of physics to shut up and sit down. -- Vaarsuvius, "Order of the Stick" http://www.giantitp.com/comics/oots0107.html