diff options
author | Louis Pilfold <louis@lpil.uk> | 2019-05-04 21:39:20 +0000 |
---|---|---|
committer | Louis Pilfold <louis@lpil.uk> | 2019-05-04 21:39:20 +0000 |
commit | df54ea2835a094d1716dbace5108d76c49ffbb3b (patch) | |
tree | f6141a390ec01ede8483e6883917ef5ec73ce533 /test | |
parent | 40499a14d0565f9c8edb4f01c99a9199bcb73c6e (diff) | |
download | gleam_stdlib-df54ea2835a094d1716dbace5108d76c49ffbb3b.tar.gz gleam_stdlib-df54ea2835a094d1716dbace5108d76c49ffbb3b.zip |
map_dict:merge
Diffstat (limited to 'test')
-rw-r--r-- | test/map_dict_test.gleam | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/test/map_dict_test.gleam b/test/map_dict_test.gleam index a0797c2..1ee489a 100644 --- a/test/map_dict_test.gleam +++ b/test/map_dict_test.gleam @@ -133,3 +133,32 @@ pub fn drop_test() { |> map_dict:drop(_, ["a", "b", "d"]) |> expect:equal(_, map_dict:from_list([{"c", 2}])) } + +pub fn merge_test() { + let a = map_dict:from_list([ + {"a", 2}, + {"c", 4}, + {"d", 3}, + ]) + let b = map_dict:from_list([ + {"a", 0}, + {"b", 1}, + {"c", 2}, + ]) + + map_dict:merge(a, b) + |> expect:equal(_, map_dict:from_list([ + {"a", 0}, + {"b", 1}, + {"c", 2}, + {"d", 3}, + ])) + + map_dict:merge(b, a) + |> expect:equal(_, map_dict:from_list([ + {"a", 2}, + {"b", 1}, + {"c", 4}, + {"d", 3}, + ])) +} |