From 7fbe619f72b2f8ec672b50571609efa4b7ea61d5 Mon Sep 17 00:00:00 2001 From: Eric Willigers Date: Mon, 10 Aug 2026 16:41:53 +1000 Subject: [PATCH] phone-number: return null on invalid input Remove interface version check in bin/.test-in-docker --- bin/.test-in-docker | 9 ++++++--- .../practice/phone-number/.docs/instructions.append.md | 6 ++++++ 2 files changed, 12 insertions(+), 3 deletions(-) create mode 100644 exercises/practice/phone-number/.docs/instructions.append.md diff --git a/bin/.test-in-docker b/bin/.test-in-docker index bb5c1433..9adbba67 100644 --- a/bin/.test-in-docker +++ b/bin/.test-in-docker @@ -18,12 +18,15 @@ for slug in $all_slugs; do # their solution. cp /tmp/solution/.meta/example.zig "/tmp/solution/${snake}.zig" bin/run.sh "${slug}" /tmp/solution /tmp/solution > /dev/null - solution_pattern=$(cat /tmp/solution/results.json | jq -r tostring | grep "{\"version\":2,\"status\":\"pass\"") errors="" - if [ -z "$solution_pattern" ]; then - errors="${errors}\n\nSolution is incorrect:\n$(cat /tmp/solution/results.json | jq -r '.message')" + if ! jq -e '.status == "pass"' /tmp/solution/results.json > /dev/null; then + # A compile error reports at the top level; failing tests report per test. + errors="${errors}\n\nSolution is incorrect:\n$(jq -r ' + .message + // ([.tests[]? | select(.status != "pass") | "\(.name):\n\(.message // "no message")"] | join("\n\n")) + ' /tmp/solution/results.json)" local_exit_code=1; fi diff --git a/exercises/practice/phone-number/.docs/instructions.append.md b/exercises/practice/phone-number/.docs/instructions.append.md new file mode 100644 index 00000000..2bbe85a6 --- /dev/null +++ b/exercises/practice/phone-number/.docs/instructions.append.md @@ -0,0 +1,6 @@ +# Instructions append + +## Invalid numbers + +`clean` returns `?[10]u8`, an optional array of ten digits. +Return `null` for a number that cannot be cleaned up.