Skip to content

Commit 7f7464b

Browse files
phone-number: return null on invalid input
1 parent 4d31034 commit 7f7464b

2 files changed

Lines changed: 12 additions & 3 deletions

File tree

bin/.test-in-docker

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,15 @@ for slug in $all_slugs; do
1818
# their solution.
1919
cp /tmp/solution/.meta/example.zig "/tmp/solution/${snake}.zig"
2020
bin/run.sh "${slug}" /tmp/solution /tmp/solution > /dev/null
21-
solution_pattern=$(cat /tmp/solution/results.json | jq -r tostring | grep "{\"version\":2,\"status\":\"pass\"")
2221

2322
errors=""
2423

25-
if [ -z "$solution_pattern" ]; then
26-
errors="${errors}\n\nSolution is incorrect:\n$(cat /tmp/solution/results.json | jq -r '.message')"
24+
if ! jq -e '.status == "pass"' /tmp/solution/results.json > /dev/null; then
25+
# A compile error reports at the top level; failing tests report per test.
26+
errors="${errors}\n\nSolution is incorrect:\n$(jq -r '
27+
.message
28+
// ([.tests[]? | select(.status != "pass") | "\(.name):\n\(.message // "no message")"] | join("\n\n"))
29+
' /tmp/solution/results.json)"
2730
local_exit_code=1;
2831
fi
2932

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# Instructions append
2+
3+
## Invalid numbers
4+
5+
`clean` returns `?[10]u8`, an optional array of ten digits.
6+
Return `null` for a number that cannot be cleaned up.

0 commit comments

Comments
 (0)