Movatterモバイル変換


[0]ホーム

URL:


Test::use::ok
(source,CPAN)
version 1.302194
You are viewing the version of this documentation from Perl 5.38.3.View the latest version

CONTENTS

#NAME

Test::use::ok - Alternative to Test::More::use_ok

#SYNOPSIS

use ok 'Some::Module';

#DESCRIPTION

According to theTest::More documentation, it is recommended to runuse_ok() inside aBEGIN block, so functions are exported at compile-time and prototypes are properly honored.

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 addBEGIN, or mistakenly groupuse_ok with other tests in a singleBEGIN block, which can create subtle differences in execution order.

With this module, simply change alluse_ok in test scripts touse ok, and they will be executed atBEGIN time. The explicit space afteruse makes it clear that this is a single compile-time action.

#SEE ALSO

Test::More

#MAINTAINER

#Chad Granum <exodist@cpan.org>

#CC0 1.0 Universal

To the extent possible under law, 唐鳳 has waived all copyright and related or neighboring rights toTest-use-ok.

This work is published from Taiwan.

http://creativecommons.org/publicdomain/zero/1.0

Perldoc Browser is maintained by Dan Book (DBOOK). Please contact him via theGitHub issue tracker oremail regarding any issues with the site itself, search, or rendering of documentation.

The Perl documentation is maintained by the Perl 5 Porters in the development of Perl. Please contact them via thePerl issue tracker, themailing list, orIRC to report any issues with the contents or format of the documentation.


[8]ページ先頭

©2009-2025 Movatter.jp