10
我正在爲PHPUnit編寫一個Vim編譯器插件。phpunit的Vim errorformat
我寫過以下errorformat
。錯誤消息被正確提取,但文件和行號不是。
CompilerSet errorformat=%E%n)\ %.%#,
\%C%m,
\%+C%$,
\%C%f:%l,
\%Z%$
PHPUnit的輸出看起來是這樣的:
PHPUnit 3.5.12 by Sebastian Bergmann.
............................................................... 63/134 (47%)
.........................E.....
Time: 0 seconds, Memory: 11.25Mb
There was 1 error:
1) SomeClassTest::testSomething
Undefined property: SomeClass::$var
/path/to/SomeClass.php:99
/path/to/SomeClassTest.php:15
FAILURES!
Tests: 94, Assertions: 170, Errors: 1.
Press ENTER or type command to continue
我很高興的報告文件和行是無論是在堆棧跟蹤的第一個或最後一個條目。最深的呼籲是問題的實際根源。跳到最高級別的通話意味着我可以用來進入通話堆棧。在上面的例子中,我更喜歡後者,SomeClassTest.php:15
。
謝謝Ilkka!這是一種享受。 – afternoon 2011-03-14 09:40:15
我已經在Github上的一個插件中發佈了代碼: https://github.com/afternoon/vim-phpunit – afternoon 2011-03-14 09:48:39
再看一遍,也許它沒有工作的原因是'%+ C%$ ''會在'%Z%$'之前始終匹配,因此多行消息從來沒有被正確地關閉。 – Ilkka 2011-03-14 10:32:00