diff options
author | Louis Pilfold <louis@lpil.uk> | 2021-09-01 22:13:56 +0100 |
---|---|---|
committer | Louis Pilfold <louis@lpil.uk> | 2021-09-01 22:13:56 +0100 |
commit | 165acf00cc9edff603bf200a2b8ce73c6577621d (patch) | |
tree | 4cc349d2939372eb2f54b8b8ebe53ad80079bd40 /test | |
parent | 2455b836fc97492b58bcda34fa689d5f570a4a21 (diff) | |
download | gleam_stdlib-165acf00cc9edff603bf200a2b8ce73c6577621d.tar.gz gleam_stdlib-165acf00cc9edff603bf200a2b8ce73c6577621d.zip |
Move Map impl to Gleam and a JS class
Diffstat (limited to 'test')
-rw-r--r-- | test/gleam/map_test.gleam | 24 |
1 files changed, 17 insertions, 7 deletions
diff --git a/test/gleam/map_test.gleam b/test/gleam/map_test.gleam index 449509a..fc90b93 100644 --- a/test/gleam/map_test.gleam +++ b/test/gleam/map_test.gleam @@ -106,9 +106,19 @@ pub fn drop_test() { |> should.equal(map.from_list([#("c", 2)])) } +pub fn merge_same_key_test() { + let a = map.from_list([#("a", 2)]) + let b = map.from_list([#("a", 0)]) + + map.merge(a, b) + |> should.equal(map.from_list([#("a", 0)])) + + map.merge(b, a) + |> should.equal(map.from_list([#("a", 2)])) +} + pub fn merge_test() { let a = map.from_list([#("a", 2), #("c", 4), #("d", 3)]) - let b = map.from_list([#("a", 0), #("b", 1), #("c", 2)]) map.merge(a, b) @@ -140,13 +150,13 @@ pub fn update_test() { |> map.update("a", inc_or_zero) |> should.equal(map.from_list([#("a", 1), #("b", 1), #("c", 2)])) - // dict - // |> map.update("b", inc_or_zero) - // |> should.equal(map.from_list([#("a", 0), #("b", 2), #("c", 2)])) + dict + |> map.update("b", inc_or_zero) + |> should.equal(map.from_list([#("a", 0), #("b", 2), #("c", 2)])) - // dict - // |> map.update("z", inc_or_zero) - // |> should.equal(map.from_list([#("a", 0), #("b", 1), #("c", 2), #("z", 0)])) + dict + |> map.update("z", inc_or_zero) + |> should.equal(map.from_list([#("a", 0), #("b", 1), #("c", 2), #("z", 0)])) } pub fn fold_test() { |