zig
zig copied to clipboard
exercises(grains): assert, rather than returning error union
I think that returning an error union here isn't particularly interesting. I think most of the exercises that currently contain (or previously contained) a single-item error set are better if the relevant functions return an optional, or say that it is the caller's responsibility to do input validation.
This PR is a follow-up to https://github.com/exercism/zig/commit/290e7f31ea8a521752885c94c4e771398191dfae, which removed the negative input test case.
Note that we should be able to add the "bad input" tests again in the future - Zig plans to give std.testing
the ability to expect a panic.
Merging this PR will break everybody's solution.
Refs: #229
Similar to #335
To-do:
- [ ] Check whether we should add an
.append
file that explains how toassert