unison/unison-src/transcripts-using-base/failure-tests.md
2024-06-25 11:11:07 -07:00

650 B

Tests the Failures generated by builtin functions.

There are three places that the builtins build Failures. One is for builtins that return Either Failure, one is for builtins that use the Exception ability directly, and the last is code validation. I don't have an easy way to test the last at the moment, but the other two are tested here.

test1 : '{IO, Exception} [Result]
test1 = do
  _ = fromUtf8 0xsee
  [Ok "test1"]

test2 : '{IO, Exception} [Result]
test2 = do
  _ = tryEval '(bug "whoa")
  [Ok "test2"]
scratch/main> add
scratch/main> io.test test1
scratch/main> io.test test2