モダンPerl入門で、テストに入門してみた。その2 Test::Harness
Test::Harness を使ってみる
テストを行う対象は、その1で作った物。
バージョンは3.22 が入っていたのでそのまま使用。
とりあえず、書いてある通りに実行
> prove --timer [21:28:38] t/00_compile.t .. 1/1 # Failed test 'use Example::Software;' # at t/00_compile.t line 8. # Tried to use 'Example::Software'. # Error: Can't locate Example/Software.pm in @INC (@INC contains: /usr/lib64/perl5/site_perl/5.8.8/x86_64-linux-thread-multi /usr/lib/perl5/site_perl/5.8.8 /usr/lib/perl5/site_perl /usr/lib64/perl5/vendor_perl/5.8.8/x86_64-linux-thread-multi /usr/lib/perl5/vendor_perl/5.8.8 /usr/lib/perl5/vendor_perl /usr/lib64/perl5/5.8.8/x86_64-linux-thread-multi /usr/lib/perl5/5.8.8 .) at (eval 4) line 2. # BEGIN failed--compilation aborted at (eval 4) line 2. # Looks like you failed 1 test of 1. [21:28:38] t/00_compile.t .. Dubious, test returned 1 (wstat 256, 0x100) Failed 1/1 subtests [21:28:38] Test Summary Report
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- -
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
パスの解釈ができてない模様。
ぐぐってみる。
--blibオプショを付けるといいっぽい。
というわけで、再度実行
> prove --blib --timer [21:42:20] t/00_compile.t .. ok 20 ms [21:42:20] All tests successful. Files=1, Tests=1, 0 wallclock secs ( 0.03 usr 0.00 sys + 0.01 cusr 0.00 csys = 0.04 CPU) Result: PASS
OK。できた。
prove のオプションについてググる前にヘルプ読めよと思ったので、読んでみる。
- -l, --lib
- lib をパスに追加する(-Ilib)
- -b, --blib
- lib/lib と blib/arch をパスに追加する
-l でもよさそうなところだけど、-bを付けておいたほうが間違いない感じ。