diff options
author | Alice Dee <alice.dee@guardian.co.uk> | 2019-09-17 12:45:44 +0100 |
---|---|---|
committer | Louis Pilfold <louis@lpil.uk> | 2019-09-17 12:59:32 +0100 |
commit | 01a691b6e7df1834b1f75e07617a209770c48fbf (patch) | |
tree | 58a8e99dd313d975c38dbd24effe1f381c326858 /test | |
parent | 198beba763f8bc0fd35b5b6ba36e42c5926ecc8c (diff) | |
download | gleam_stdlib-01a691b6e7df1834b1f75e07617a209770c48fbf.tar.gz gleam_stdlib-01a691b6e7df1834b1f75e07617a209770c48fbf.zip |
Move fetch to list module as key_find
Diffstat (limited to 'test')
-rw-r--r-- | test/gleam/list_test.gleam | 17 | ||||
-rw-r--r-- | test/gleam/pair_test.gleam | 16 |
2 files changed, 17 insertions, 16 deletions
diff --git a/test/gleam/list_test.gleam b/test/gleam/list_test.gleam index e211947..cdb7a8d 100644 --- a/test/gleam/list_test.gleam +++ b/test/gleam/list_test.gleam @@ -358,3 +358,20 @@ pub fn split_while_test() { list.split_while([1, 2, 3, 4, 5], fn(x) { x <= -3 }) |> expect.equal(_, pair.Pair([], [1, 2, 3, 4, 5])) } + + +pub fn key_find_test() { + let proplist = [pair.Pair(0, "1"), pair.Pair(1, "2")] + + proplist + |> list.key_find(_, 0) + |> expect.equal(_, Ok("1")) + + proplist + |> list.key_find(_, 1) + |> expect.equal(_, Ok("2")) + + proplist + |> list.key_find(_, 2) + |> expect.is_error +} diff --git a/test/gleam/pair_test.gleam b/test/gleam/pair_test.gleam index 86a9e1e..d8cb324 100644 --- a/test/gleam/pair_test.gleam +++ b/test/gleam/pair_test.gleam @@ -18,19 +18,3 @@ pub fn swap_test() { |> pair.swap |> expect.equal(_, pair.Pair("2", 1)) } - -// pub fn fetch_test() { -// let proplist = [pair.Pair(0, "1"), pair.Pair(1, "2")] - -// proplist -// |> pair.fetch(_, 0) -// |> expect.equal(_, Ok("1")) - -// proplist -// |> pair.fetch(_, 1) -// |> expect.equal(_, Ok("2")) - -// proplist -// |> pair.fetch(_, 2) -// |> expect.is_error -// } |