diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/gleam/option_test.gleam | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/test/gleam/option_test.gleam b/test/gleam/option_test.gleam index 7271769..0db3adf 100644 --- a/test/gleam/option_test.gleam +++ b/test/gleam/option_test.gleam @@ -47,7 +47,7 @@ pub fn map_option_test() { |> should.equal(Some(2)) Some(1) - |> option.map(fn(x) { "2" }) + |> option.map(fn(_) { "2" }) |> should.equal(Some("2")) None @@ -75,10 +75,28 @@ pub fn then_option_test() { |> should.equal(Some(2)) Some(1) - |> option.then(fn(x) { Some("2") }) + |> option.then(fn(_) { Some("2") }) |> should.equal(Some("2")) None |> option.then(fn(x) { Some(x + 1) }) |> should.equal(None) } + +pub fn or_option_test() { + Some(1) + |> option.or(Some(2)) + |> should.equal(Some(1)) + + Some(1) + |> option.or(None) + |> should.equal(Some(1)) + + None + |> option.or(Some(2)) + |> should.equal(Some(2)) + + None + |> option.or(None) + |> should.equal(None) +} |