mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
b90bae79da
When testing a function that can return an error, writing a test like this allows you to more easily test the non-error flow by just propagating any errors and letting them fail the test. I didn't realize this was a feature at first, so I was writing tests like: ``` fn test_atoi() { assert strconv.atoi('1') or { panic("atoi failed") } == 1 assert strconv.atoi('one') or { panic("atoi failed") } == 1 } ``` |
||
---|---|---|
.. | ||
docs.md | ||
upcoming.md |