In certain instances a test file may not know how many test points it will ultimately be running. In this case the plan can be the last non-diagnostic line in the output.
This feature is new to me--and I have to say, it seems nearly useless. I consider that the primary purpose of a plan is to ensure that the test runs to completion, not so much to verify that the test script contains the number of tests believed. (The latter assertion seems either trivial, for a simple test script--it's not as though perl capriciously skips the occasional line of code--or unreliable, for a complex test script--the right number of tests might run, but they could be the wrong tests; for which the solution would be to list the names (er, descriptions) of the tests expected to run.) Anyhow, the plan at the end does not help to ensure that the test runs to completion, because if it never appears, the harness doesn't know it was expected. I propose to fix this by allowing, in place of a plan at the beginning, something like the line "ends with plan". If this is seen and no plan shows up, the whole script is considered to have failed. In addition, I propose something like "ends with done", in which case the harness should expect the last line to be simply "done". This gives the benefit of ensuring that the script runs to completion, without the tedium of counting tests, for those of us who aren't into that. Andrew