diff options
author | Ahmad Sattar <thehabbos007@gmail.com> | 2020-06-18 19:04:03 +0200 |
---|---|---|
committer | Louis Pilfold <louis@lpil.uk> | 2020-06-18 21:55:52 +0100 |
commit | eb0224d3f26c4fd90894bac5fb346c2aa3533efe (patch) | |
tree | b254db7c49fe937f1c90f5169f263b7c72d5e2d7 /test | |
parent | 7198eab42221bd99a0aa82795688aecc27533bc1 (diff) | |
download | gleam_stdlib-eb0224d3f26c4fd90894bac5fb346c2aa3533efe.tar.gz gleam_stdlib-eb0224d3f26c4fd90894bac5fb346c2aa3533efe.zip |
Result or function
Diffstat (limited to 'test')
-rw-r--r-- | test/gleam/result_test.gleam | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/test/gleam/result_test.gleam b/test/gleam/result_test.gleam index f6d7f6d..9bfbe66 100644 --- a/test/gleam/result_test.gleam +++ b/test/gleam/result_test.gleam @@ -100,3 +100,21 @@ pub fn nil_error_test() { |> result.nil_error |> should.equal(Ok(1)) } + +pub fn or_result_test() { + Ok(1) + |> result.or(Ok(2)) + |> should.equal(Ok(1)) + + Ok(1) + |> result.or(Error("Error 2")) + |> should.equal(Ok(1)) + + Error("Error 1") + |> result.or(Ok(2)) + |> should.equal(Ok(2)) + + Error("Error 1") + |> result.or(Error("Error 2")) + |> should.equal(Error("Error 2")) +} |