< :前の番号
^ :番号順リスト
> :次の番号
P :前の記事(スレッド移動)
N :次の記事
|<:前のスレッド
>|:次のスレッド
^ :返事先
_:自分への返事
>:同じ返事先を持つ記事(前)
<:同じ返事先を持つ記事(後)
---:分割してスレッド表示、再表示
| :分割して(縦)スレッド表示、再表示
~ :スレッドのフレーム消去
.:インデックス
..:インデックスのインデックス
西松と申します.
Emacsでユニットテストを行いつつRubyプログラミングをする場合,
M-x compile [Enter] (ぼくはC-cC-cに割り当てています.)
ruby testaaa-testunit.rb [Enter] (スクリプトにLocal variables:, compile-command:,
End: で書いておくと便利です.)
でテストを繰り返すと便利です. さらにテストにFailureがあった場合に
M-x next-error [Enter] (ぼくはC-cnに割り当てています.)
でユニットテストスクリプトのFailureの箇所にカーソルが飛んで
行ってくれると便利です. これを実現するには下記のような方法が
あると思うのですが, どれがいちばんスマートでしょう. それとも
もっとよい方法がありますでしょうか.
(a) .emacs に
(add-hook 'compilation-mode-hook
(function (lambda ()
(add-to-list 'compilation-error-regexp-alist
'(".+\\[\\(.+\\):\\([0-9]+\\)\\]:" 1 2)))))
と書いておく. *2回目*のcompileから可能になる. (regexp は
あまり試していないのでちょっと自信なし.)
(b) /ELSEWHERE/share/emacs/21.4/lisp/progmodes/compile.el の
compilation-error-regexp-alist の定義の最後のところに
(".+\\[\\(.+\\):\\([0-9]+\\)\\]:" 1 2) を直接書き加える.
(c) Test::Unit が GNU utilities の形式 (foo.rb:10: message)で
Failureを報告するようにする. (M.Suketaさんのrubyunit-0.5.6は
そうだった. しかし今となっては他の IDE (Integrated Development
Environment) に悪影響があるかもしれない.)
(d) ruby-mode.el に何かを書けばよい?
Emacs での *compilation* バッファの出力例:
cd /home/t-nissie/ruby/UnitTest/
ruby testaaa-testunit.rb
Loaded suite testaaa-testunit
Started
..F
Finished in 0.070802 seconds.
1) Failure:
test_xy(TestAaa) [testaaa-testunit.rb:18]: <=== ここにマッチしないといけない
<0.5> and
<0.6> expected to be within
<1.0e-10> of each other.
3 tests, 4 assertions, 1 failures, 0 errors
Compilation exited abnormally with code 1 at Thu Aug 4 13:06:26
--
love && peace && free_software
西松 タケシ