aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorLouis Pilfold <louis@lpil.uk>2023-10-02 22:23:51 +0100
committerLouis Pilfold <louis@lpil.uk>2023-10-02 22:23:51 +0100
commit081a4d9c417a971e00d7f0ea6706206d770d4733 (patch)
treebb602ac2f2b4cc2c341a5b7a57fbc5748137262c /test
parenteda52ed9eee0b51efc4e3b70cdd77c60fd80447a (diff)
downloadgleam_stdlib-081a4d9c417a971e00d7f0ea6706206d770d4733.tar.gz
gleam_stdlib-081a4d9c417a971e00d7f0ea6706206d770d4733.zip
list.key_filter
Diffstat (limited to 'test')
-rw-r--r--test/gleam/list_test.gleam20
1 files changed, 20 insertions, 0 deletions
diff --git a/test/gleam/list_test.gleam b/test/gleam/list_test.gleam
index 321f5a4..ae066ad 100644
--- a/test/gleam/list_test.gleam
+++ b/test/gleam/list_test.gleam
@@ -821,6 +821,26 @@ pub fn key_find_test() {
|> should.equal(Error(Nil))
}
+pub fn key_filter_test() {
+ let proplist = [#(0, "1"), #(1, "2"), #(0, "3"), #(1, "4"), #(2, "5")]
+
+ proplist
+ |> list.key_filter(0)
+ |> should.equal(["1", "3"])
+
+ proplist
+ |> list.key_filter(1)
+ |> should.equal(["2", "4"])
+
+ proplist
+ |> list.key_filter(2)
+ |> should.equal(["5"])
+
+ proplist
+ |> list.key_filter(3)
+ |> should.equal([])
+}
+
pub fn pop_test() {
[1, 2, 3]
|> list.pop(fn(x) { x > 2 })