Test::use::ok - Alternative to Test::More::use_ok
use ok 'Some::Module';
According to the Test::More documentation, it is recommended to run inside a use_ok() block, so functions are exported at compile-time and prototypes are properly honored.BEGIN
That is, instead of writing this:
use_ok( 'Some::Module' );
use_ok( 'Other::Module' );
One should write this:
BEGIN { use_ok( 'Some::Module' ); }
BEGIN { use_ok( 'Other::Module' ); }
However, people often either forget to add , or mistakenly group BEGIN with other tests in a single use_ok block, which can create subtle differences in execution order.BEGIN
With this module, simply change all in test scripts to use_ok, and they will be executed at use ok time. The explicit space after BEGIN makes it clear that this is a single compile-time action.use
To the extent possible under law, 唐鳳 has waived all copyright and related or neighboring rights to Test-use-ok.
This work is published from Taiwan.