A. Pagaltzis wrote:
> Yes, so this should be allowed:
> 
>     pass();
>     plan 'no_plan';
>     pass();
> 
> Whereas this should not:
> 
>     pass();
>     plan tests => 2;
>     pass();

Umm, why not?  That's exactly what I was proposing and it would result in...

        ok 1
        ok 2
        1..2


> Consider also:
> 
>     pass();
>     plan skip_all => 'Surprise!';
>     pass();

Good point.  That wouldn't work, there's no way to express "skip_all" once a
test has been issued.  There are ways Test::More could cheat to make it work,
but that goes against it's intent to be as explicit as possible.  Running a
test and then stating that you're going to skip all tests is ambiguous.

It does splash some cold water on eliminating the common mistake of running a
use_ok() before deciding if you can or cannot run the tests.


>> It also makes it technically possible to allow the test to
>> change it's plan mid-stream
> 
> Without some hypothetical future version of TAP this is only
> possible if you have run tests before declaring a plan at all,
> because otherwise the plan will already have been output as the
> first line of the TAP stream.

Just needs a way to declare that you're going to add to the plan up front.


>> Since the technical restriction is gone, and I see no
>> particular benefit to it being there, and it eliminates some
>> tricky plan counting situations, I don't see why it shouldn't
>> be removed.
> 
> Because declaring a plan after running tests is effectively a
> no_plan and the programmer should be aware that that’s what they
> did. It’s fine if that’s their conscious choice; just make sure
> it was.

No, it's critically different from a no_plan in that the number of tests to be
run is still fixed by the programmer.  For example...

        pass();
        plan tests => 3;
        pass();

Would produce...

        ok 1
        ok 2
        1..3

Which would be a failure, just as if the plan was at the top.


-- 
I do have a cause though. It's obscenity. I'm for it.
    - Tom Lehrer

Reply via email to