nim-stew/tests/test_results2.nim

14 lines
387 B
Nim

import ../stew/results
{.used.}
# Oddly, this piece of code works when placed in `test_results.nim`
# See also https://github.com/status-im/nim-stew/pull/167
template repeater(b: Opt[int]): untyped =
# Check that Result can be used inside a template - this fails
# sometimes with field access errors as noted in above issue
b
let x = repeater(Opt.none(int))
doAssert x.isNone()