Hi,
I'm trying to use custom error parsing with Ruby unit tests. I created a custom build tool with command line
ruby test_board.rb
This works fine to run the tests. I see output in the build window that looks like this:
1) Failure:
test_solve_true(TestBoard) [test_board.rb:88]:
<false> is not true.
2) Failure:
test_unplace(TestBoard) [test_board.rb:52]:
<false> is not true.
I use this error parsing expression:
{#3[^\[]+}\[{#0:p}\:{#1:i}\]\:
This matches the middle line of each of the errors, and works fine for prev-error/next-error navigation.
Since these error messages are multi-line, and I would like to get the message detail from the 3rd line rather than the middle one, I tried to use hs2's suggestion of piping through sed:
ruby test_board.rb 2>&1 | c:\cygwin\bin\sed.exe '/Failure/ {N;N;s/\n/ /g}'
This reformats the errors onto single lines, like this:
1) Failure: test_solve_true(TestBoard) [test_board.rb:88]: <false> is not true.
2) Failure: test_unplace(TestBoard) [test_board.rb:52]: <false> is not true.
I changed my regular expression to this:
Failure\:[^\[]+\[{#0:p}\:{#1:i}\]\:{#3?+}$
This expression works fine with the Validate button in the Edit Expression dialog, with the errors above pasted in from the Build output window. I get the correct details reporting.
But when I run the tool, I don't get any errors. next-error/prev-error report "No more errors".
I have Capture output and Output to build window on, and I can see the errors in the build window. I just can't navigate to them. Either the error parsing is not being triggered, or it is somehow missing the output, despite working with it in the Edit Expression dialog.
Is it necessary for the build command to return a non-0 exit code?
Any other ideas?
John Hurst
Wellington, New Zealand