[Ruby] Dfect
0.1.0 がリリースされた。
F、E、C、Tの4つのassertionメソッド(と、! と ? の組合せ)から構成されるシンプルなテストライブラリ。 D は Description、F は False、E は Exception、T は True を意味しているらしい。 C は Symbol なのかな?
C は Catch の Cだそうです。(2009/04/30 追記)
ちょっと試してみた。 スクリプトはこんな感じ。
require 'dfect/auto'
D "This is first test using dfect" do
a = "A"
F{a == "B"}
E{b == a}
C(:a){throw :a}
T{a == "A"}
end
D "This is second test using dfect" do
a = "A"
T!{a == "A"}
end
で実行結果は
---
:execution:
- This is first test using dfect: []
- This is second test using dfect:
- fail: block must yield false (nil || false)
code: |-
[6..13] in t.rb
06 C(:a){throw :a}
07 T{a == "A"}
08 end
09 D "This is second test using dfect" do
10 a = "A"
=> 11 T!{a == "A"}
12 end
13
vars:
a: A
call:
- t.rb:11:in `block in <main>'
:statistics:
:passed_assertions: 4
:failed_assertions: 1
つい、うっかり defect と入力してしまうよ。
| 固定リンク
この記事へのコメントは終了しました。
コメント
Thank you for writing about my library.
Regarding your doubt about the "C" method,
the "C" is for "catch" (catch a symbol).
And yes, I also find myself typing "defect" instead of "dfect".
Perhaps the intentional misspelling was not such a good idea?
Cheers.
投稿: Suraj Kurapati | 2009年4月30日 (木) 14時48分
Thank you answering my question.
And I think "dfect" is remarkable name.
投稿: suke | 2009年4月30日 (木) 15時33分