From a63339014ba5ebd5ad50b34bea53fb39d105ec52 Mon Sep 17 00:00:00 2001 From: Mikko Ahlroth Date: Sun, 15 Oct 2023 14:28:42 +0300 Subject: Fix map equality checking when the amount of keys differs --- test/gleam/map_test.gleam | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'test') diff --git a/test/gleam/map_test.gleam b/test/gleam/map_test.gleam index 75fb78d..b00331f 100644 --- a/test/gleam/map_test.gleam +++ b/test/gleam/map_test.gleam @@ -375,3 +375,19 @@ pub fn zero_must_be_contained_test() { |> map.has_key(0) |> should.equal(True) } + +pub fn empty_map_equality_test() { + let map1 = map.new() + let map2 = map.from_list([#(1, 2)]) + + should.be_false(map1 == map2) + should.be_false(map2 == map1) +} + +pub fn extra_keys_equality_test() { + let map1 = map.from_list([#(1, 2), #(3, 4)]) + let map2 = map.from_list([#(1, 2), #(3, 4), #(4, 5)]) + + should.be_false(map1 == map2) + should.be_false(map2 == map1) +} -- cgit v1.2.3