aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorPeter Saxton <peterhsaxton@gmail.com>2020-12-02 16:46:43 +0000
committerLouis Pilfold <louis@lpil.uk>2020-12-02 17:28:03 +0000
commit2f656a81c81a35d7d63bc67e9e0828b25fcca895 (patch)
tree04204cdbd856fd40920c364c6f008388090a9725 /test
parent719eccd9ab38a35e79580f684b9ebde85222eef8 (diff)
downloadgleam_stdlib-2f656a81c81a35d7d63bc67e9e0828b25fcca895.tar.gz
gleam_stdlib-2f656a81c81a35d7d63bc67e9e0828b25fcca895.zip
add lazy unwrap
Diffstat (limited to 'test')
-rw-r--r--test/gleam/result_test.gleam10
1 files changed, 10 insertions, 0 deletions
diff --git a/test/gleam/result_test.gleam b/test/gleam/result_test.gleam
index d047496..d7b6048 100644
--- a/test/gleam/result_test.gleam
+++ b/test/gleam/result_test.gleam
@@ -87,6 +87,16 @@ pub fn unwrap_test() {
|> should.equal(50)
}
+pub fn lazy_unwrap_test() {
+ Ok(1)
+ |> result.lazy_unwrap(fn() { 50 })
+ |> should.equal(1)
+
+ Error("nope")
+ |> result.lazy_unwrap(fn() { 50 })
+ |> should.equal(50)
+}
+
pub fn nil_error_test() {
Error("error_string")
|> result.nil_error