in reply to Test::Builder::skip() not dwimming.

AFAICT, it's just plain wrong usage on your part. Test::Builder::skip is just another test, like ok(...) etc.
[]s, HTH, Massa (κς,πμ,πλ)
  • Comment on Re: Test::Builder::skip() not dwimming.

Replies are listed 'Best First'.
Re^2: Test::Builder::skip() not dwimming.
by syphilis (Archbishop) on Sep 03, 2008 at 10:25 UTC
    wrong usage on your part

    I've no reason to doubt you, but I'm still struggling to understand. The Test::Builder::skip documentation suggests to me that my usage is correct. It says that calling skip() "Skips the current test". By comparison, the skip_all() documentation says that skip_all() "Skips all the tests" - and that's exactly what happens when I replace:
    $self->builder->skip('Wanting to skip the DEMO_1 tests');
    with:
    $self->builder->skip_all('Wanting to skip all tests');
    With that change in place, things dwim perfectly. I find that all of the DEMO_1 and DEMO_2 tests are skipped - unless the DEMO_2 tests have been run first, in which case only the DEMO_1 tests get skipped.

    I also don't understand how one would apply a skip() test if it is "just another test, like ok(...)". massa, is there an example somewhere of how Test::Builder::skip() is meant to be put to a useful purpose ?

    Cheers,
    Rob
      The Test::Builder::skip documentation suggests to me that my usage is correct.

      No, it doesn't. skip() is documented under:

      Other Testing Methods These are methods which are used in the course of writing a test but are not themselves tests.

      It has nothing to do with control flow. It reports one test as skipped and then immediately returns. If you run a test afterward with an actual testing method, that's a new test.

      Of course, you should only use Test::Builder directly if you're writing a test module. Don't use it directly to run tests. Use Test::Class and Test::More.

        Don't use it directly to run tests. Use Test::Class and Test::More

        Aaah, that's what I needed to know ... I now start to get the picture. Thanks for your replies, chromatic.

        Cheers,
        Rob
        Looks to me that those links deal with Test::More::skip() rather than Test::Builder::skip() ... but I'm really quite lost with this stuff. (I sure am glad I personally don't use these Test::* modules :-)

        Cheers,
        Rob