Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked

Re: Testing test function

by DrHyde (Prior)
on Sep 26, 2013 at 10:54 UTC ( #1055815=note: print w/replies, xml ) Need Help??

in reply to Testing test function

I presume that deep down inside the function you want to test there is a call to Test::More::ok(). If there isn't, there probably should be. You need to mock that function. I do this in the tests for Class::Mockable.

Replies are listed 'Best First'.
Re^2: Testing test function
by sedusedan (Monk) on Sep 26, 2013 at 11:14 UTC
    Are you saying that I need to mock Test::More's ok()? I also use subtest(), is_deeply(), is(), like() BTW, should I mock those too? Why? I'd rather execute the test in a subprocess and parse the TAP instead.
      You could do that, but beware that the TAP standard is slowly evolving. You need to make sure that you can cope when new features are added to it. You may also need to cope with code that doesn't actually use Test::More and just outputs something vaguely TAP-ish. Lots of old code's test suites contain things like this:
      print 'not ' unless($foo == 42); print 'ok '.$test++."\n";
      instead of
      ok($foo == 42);

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1055815]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (5)
As of 2019-05-26 19:34 GMT
Find Nodes?
    Voting Booth?
    Do you enjoy 3D movies?

    Results (153 votes). Check out past polls.

    • (Sep 10, 2018 at 22:53 UTC) Welcome new users!