Blog

about Test::More::done_testing

Test::More::done_testing が導入されているわけですが、みなさんつかってますか?

Test::More の 0.87_01 から導入されてる新機能なんですが

0.87_01  Sun Mar 29 09:56:52 BST 2009
    New Features
    * done_testing() allows you to declare that you have finished running tests,
      and how many you ran.  It is a safer no_plan and effectively replaces it.

というわけで、無計画な人でも安全な感じになります。

具体的には以下のような感じ。

15:24 tokuhirom: plan の逆っていうか
15:25 tokuhirom: plan で数を書くのめんどいじゃんすか
15:25 tokuhirom: でも、plan 書かないと、テストが最後までうごいたかわからんから、no_plan とか書いてると信頼性に欠ける。
15:25 tokuhirom: 途中で exit したりしたら、success になっちゃうから。
15:26 tokuhirom: だから、no_plan とか先頭で書くかわりに、オケツに done_testing 書いた方がいい
15:26 tokuhirom: というためのもの。