Lazy Diary @ Hatena Blog

PowerShell / Java / miscellaneous things about software development, Tips & Gochas. CC BY-SA 4.0/Apache License 2.0

RUnit でテストを走らせようとしたら反応がない場合

hoge.rb に書いてある class Hoge をテストしたいとする。テスト用ファイルとクラスはそれぞれ test-hoge.rb, HogeTest 。

$ tail -1 test-hoge.rb
RUNIT::CUI::TestRunner.run(HogeTest.suite)
$ ruby -w test-hoge.rb
(反応がない……)

このような場合、 hoge.rb で何か実行していないか、言いかえれば ruby -w hoge.rb として何か実行できるような状態になっていないか(例えば、標準入力から何か読んで簡単な処理を実行する、簡易テストとか……)チェック。Ctrl+D を押したら動いた、という場合はほぼ決定的。