Skip to content

Improve output parsing - #151

Merged
keiravillekode merged 1 commit into
exercism:mainfrom
keiravillekode:example-resistor
Aug 8, 2026
Merged

Improve output parsing#151
keiravillekode merged 1 commit into
exercism:mainfrom
keiravillekode:example-resistor

Conversation

@keiravillekode

Copy link
Copy Markdown
Contributor

When the tests were using helpers like expectEqualStrings, we were not parsing the output correctly.

From forum
https://forum.exercism.org/t/0-tests-failed-but-not-all-passed/71116/

From Claude:

Zig prints per-test lines like 1/N test_x.test.NAME...OK when a test
passes, but when a test fails via a rich helper (expectEqualStrings,
expectEqualSlices, or checkAllAllocationFailures's leak detection) the
diagnostic is emitted first and the header line ends with a bare ....

The jq definition

  def user_output: capture("\\.\\.\\.((?<o>.+)$)") | .o // "";

returned empty (not null) when the regex didn't match. // doesn't
fire on empty, and map(classify) silently drops any element whose
subexpressions yield empty — so every failing test whose header ended
with a bare ... was quietly removed from the tests array.

We now use

def user_output: (capture("\.\.\.(?.+)$") | .o) // "";

When the tests were using helpers like expectEqualStrings,
we were not parsing the output correctly.

From forum
https://forum.exercism.org/t/0-tests-failed-but-not-all-passed/71116/

From Claude:

  Zig prints per-test lines like `1/N test_x.test.NAME...OK` when a test
  passes, but when a test fails via a rich helper (expectEqualStrings,
  expectEqualSlices, or checkAllAllocationFailures's leak detection) the
  diagnostic is emitted first and the header line ends with a bare `...`.

  The jq definition

      def user_output: capture("\\.\\.\\.((?<o>.+)$)") | .o // "";

  returned *empty* (not null) when the regex didn't match. `//` doesn't
  fire on empty, and `map(classify)` silently drops any element whose
  subexpressions yield empty — so every failing test whose header ended
  with a bare `...` was quietly removed from the tests array.

We now use

  def user_output: (capture("\\.\\.\\.(?<o>.+)$") | .o) // "";
@keiravillekode
keiravillekode requested a review from a team as a code owner August 8, 2026 00:53
@keiravillekode
keiravillekode merged commit 3599dbe into exercism:main Aug 8, 2026
4 checks passed
@keiravillekode
keiravillekode deleted the example-resistor branch August 8, 2026 01:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants