2024-07-10 17:46:18 +03:00
|
|
|
``` unison
|
2023-07-11 06:29:00 +03:00
|
|
|
debug a = match Debug.toText a with
|
|
|
|
None -> ""
|
|
|
|
Some (Left a) -> a
|
|
|
|
Some (Right a) -> a
|
|
|
|
|
|
|
|
test> t1 = if bool then [Ok "Yay"]
|
|
|
|
else [Fail (debug [1,2,3])]
|
|
|
|
bool = true
|
|
|
|
|
|
|
|
allowDebug = debug [1,2,3]
|
|
|
|
```
|
|
|
|
|
2024-07-10 19:17:15 +03:00
|
|
|
``` ucm
|
2023-07-11 06:29:00 +03:00
|
|
|
|
2023-12-22 14:55:24 +03:00
|
|
|
Loading changes detected in scratch.u.
|
|
|
|
|
2023-07-11 06:29:00 +03:00
|
|
|
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`:
|
|
|
|
|
|
|
|
allowDebug : Text
|
|
|
|
bool : Boolean
|
|
|
|
debug : a -> Text
|
|
|
|
t1 : [Result]
|
|
|
|
|
|
|
|
Now evaluating any watch expressions (lines starting with
|
|
|
|
`>`)... Ctrl+C cancels.
|
|
|
|
|
|
|
|
6 | test> t1 = if bool then [Ok "Yay"]
|
|
|
|
|
|
|
|
✅ Passed Yay
|
|
|
|
|
|
|
|
```
|
2024-07-10 19:17:15 +03:00
|
|
|
``` ucm
|
2024-06-12 01:22:09 +03:00
|
|
|
scratch/main> add
|
2023-07-11 06:29:00 +03:00
|
|
|
|
|
|
|
⍟ I've added these definitions:
|
|
|
|
|
|
|
|
allowDebug : Text
|
|
|
|
bool : Boolean
|
|
|
|
debug : a -> Text
|
|
|
|
t1 : [Result]
|
|
|
|
|
2024-06-12 01:22:09 +03:00
|
|
|
scratch/main> test
|
2023-07-11 06:29:00 +03:00
|
|
|
|
|
|
|
Cached test results (`help testcache` to learn more)
|
|
|
|
|
2024-06-27 08:14:37 +03:00
|
|
|
1. t1 ◉ Yay
|
2023-07-11 06:29:00 +03:00
|
|
|
|
|
|
|
✅ 1 test(s) passing
|
|
|
|
|
2024-06-26 23:01:36 +03:00
|
|
|
Tip: Use view 1 to view the source of a test.
|
2023-07-11 06:29:00 +03:00
|
|
|
|
|
|
|
```
|
2024-07-10 17:46:18 +03:00
|
|
|
``` unison
|
2023-07-11 06:29:00 +03:00
|
|
|
bool = false
|
|
|
|
```
|
|
|
|
|
2024-07-10 19:17:15 +03:00
|
|
|
``` ucm
|
2023-07-11 06:29:00 +03:00
|
|
|
|
2023-12-22 14:55:24 +03:00
|
|
|
Loading changes detected in scratch.u.
|
|
|
|
|
2023-07-11 06:29:00 +03:00
|
|
|
I found and typechecked these definitions in scratch.u. If you
|
|
|
|
do an `add` or `update`, here's how your codebase would
|
|
|
|
change:
|
|
|
|
|
|
|
|
⍟ These names already exist. You can `update` them to your
|
|
|
|
new definition:
|
|
|
|
|
|
|
|
bool : Boolean
|
|
|
|
|
|
|
|
```
|
2024-07-10 19:17:15 +03:00
|
|
|
``` ucm
|
2024-06-12 01:22:09 +03:00
|
|
|
scratch/main> update.old
|
2023-07-11 06:29:00 +03:00
|
|
|
|
|
|
|
⍟ I've updated these names to your new definition:
|
|
|
|
|
|
|
|
bool : Boolean
|
|
|
|
|
2024-06-12 01:22:09 +03:00
|
|
|
scratch/main> test
|
2023-07-11 06:29:00 +03:00
|
|
|
|
|
|
|
✅
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
New test results:
|
|
|
|
|
2024-06-27 08:14:37 +03:00
|
|
|
1. t1 ✗ [1, 2, 3]
|
2023-07-11 06:29:00 +03:00
|
|
|
|
|
|
|
🚫 1 test(s) failing
|
|
|
|
|
2024-06-26 23:01:36 +03:00
|
|
|
Tip: Use view 1 to view the source of a test.
|
2023-07-11 06:29:00 +03:00
|
|
|
|
|
|
|
```
|