develooper Front page | perl.perl5.porters | Postings from April 2006

t/op/grep.t one-sided tests

Thread Next
From:
David Landgren
Date:
April 29, 2006 05:37
Subject:
t/op/grep.t one-sided tests
Message ID:
44535F2C.7050909@landgren.net
t/op/grep.t contains some oddities like:

    print map({$_} ("ok $test\n"));
    $test++;

    print map
             ({$_} ("ok $test\n"));
    $test++;

This is all very well if the tests succeed, but if they fail, the only 
indication will be that the test counts at the end of the run will be 
off by one (or how ever many), but you're on your own as to figuring out 
which test failed. What is being tested here? Is the following equivalent?

     my $orig = 'lazar';
     my ($result) = map({$_} ($orig));
     cmp_ok($orig,'eq',$result,'whatever');

(or maybe @result, if it's a question of scalar/list context?)

Thanks,
David
-- 
hope still, a little resistance always maybe stubborn tiny lights vs. 
clustering darkness forever ok?

Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About