in reply to Working with Test::More

Well, it seems like there are several ways to go. Here's one. Create a module that exports plan() and ok() by itself (i.e. fakes them without using Test::More). Then distribute that module along with the test and put the code below at the top of the test. This way you only write your tests once, rather than two versions of all tests like you have.
BEGIN { eval { use Test::More; }; if ($@) { use myModuleThatBehavesLikeTestMore; } }

Replies are listed 'Best First'.
Re: Working with Test::More
by Abigail-II (Bishop) on Oct 29, 2003 at 16:17 UTC
    What is the point of this? Why is this preferable over:
    use myModuleThatBehavesLikeTestMore;

    It's not saving you to write code. It's not saving disk space. What's the gain here?

    Abigail

      There's a big gain over the OP's original version. As for a gain over just ignoring Test::More, I can think of two (neither of which really amounts to a hill of beans): 1) you could test your own test by making sure that it produced the same results with Test::More and myMTBLikeTestMore and 2) you could upload myMTBLTestMore to CPAN so others could use it and then a hilarious amount of recursiveness could occur.

      Seriously though, it seems like if Test::More isn't going to be in the core (is it?), then people ought to be able to distribute it with their modules and have tests start with pseudocode( if there's a more recent Test::More locally, use it, otherwise use this one I've distributed with my module).

        you could test your own test by making sure that it produced the same results with Test::More
        How so? Because if Test::More is present, the test suite is run with Test::More, and not with myMTBLikeTestMore, so you don't compare the output of myMTBLikeTestMore because it isn't run, and if Test::More isn't present, you can't compare the results of myMTBLikeTestMore with Test::More either.

        Seriously though, it seems like if Test::More isn't going to be in the core (is it?)
        Test::More has been part of the core distribution since 5.8.0.

        then people ought to be able to distribute it with their modules
        Test::More has an Open Source license, so you're free to redistribute (and modify) its code.

        Abigail