mirror of
https://github.com/unisonweb/unison.git
synced 2024-11-04 01:03:36 +03:00
0031542faf
This is for consistency with the `cmark` style. Now the blocks we still pretty-print ourselves will match the bulk of them that `cmark` produces.
1.5 KiB
1.5 KiB
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"]
Loading changes detected in scratch.u.
I found and typechecked these definitions in scratch.u. If you
do an `add` or `update`, here's how your codebase would
change:
⍟ These new definitions are ok to `add`:
test1 : '{IO, Exception} [Result]
test2 : '{IO, Exception} [Result]
scratch/main> add
⍟ I've added these definitions:
test1 : '{IO, Exception} [Result]
test2 : '{IO, Exception} [Result]
scratch/main> io.test test1
💔💥
The program halted with an unhandled exception:
Failure
(typeLink IOFailure)
"Cannot decode byte '\\xee': Data.Text.Internal.Encoding.decodeUtf8: Invalid UTF-8 stream"
(Any ())
Stack trace:
##raise
scratch/main> io.test test2
💔💥
The program halted with an unhandled exception:
Failure (typeLink RuntimeFailure) "builtin.bug" (Any "whoa")
Stack trace:
##raise