diff options
| author | Jan Tuomi <jans.tuomi@gmail.com> | 2022-12-09 18:55:21 +0200 |
|---|---|---|
| committer | Jan Tuomi <jans.tuomi@gmail.com> | 2022-12-09 18:55:21 +0200 |
| commit | 8ba98a86805c886719057f9df0d5a74c58c6dabd (patch) | |
| tree | 8bb5a0890f9a69c01ff219553750058b5da82476 /test/scripts | |
| parent | cff5a0dfa89ab3a7f95512382cedf88f8e1709d1 (diff) | |
Add do builtin
Diffstat (limited to 'test/scripts')
| -rw-r--r-- | test/scripts/do1.milch | 7 | ||||
| -rw-r--r-- | test/scripts/try1.milch | 8 |
2 files changed, 15 insertions, 0 deletions
diff --git a/test/scripts/do1.milch b/test/scripts/do1.milch new file mode 100644 index 0000000..d66c122 --- /dev/null +++ b/test/scripts/do1.milch @@ -0,0 +1,7 @@ +(let foo + (do (+ 1 2) + (- 10 2) + "foo")) + +foo +; => "foo" diff --git a/test/scripts/try1.milch b/test/scripts/try1.milch new file mode 100644 index 0000000..32abba2 --- /dev/null +++ b/test/scripts/try1.milch @@ -0,0 +1,8 @@ +(import "core/common") +(import "core/result") + +(let safe-read-file! (Result/safe! read-file!)) + +; calls read-file! and wraps the result in a Result/ok on success +; in case of error, calls Result/ex on the error string +(safe-read-file! "does-not-exist.txt") |
