Skip to content

Commit f541e71

Browse files
committed
Add test for map representation invariant
1 parent 7765fea commit f541e71

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

lib/elixir/test/elixir/module/types/descr_test.exs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,18 @@ defmodule Module.Types.DescrTest do
135135
# Test union of open map and map with domain key
136136
assert union(open_map(), open_map([{domain_key(:integer), atom()}]))
137137
|> equal?(open_map())
138+
139+
# Ensure no duplicate, no matter the order
140+
assert union(
141+
open_map(a: integer()),
142+
open_map(a: number(), b: binary())
143+
)
144+
|> union(open_map(a: integer())) ==
145+
union(
146+
open_map(a: number(), b: binary()),
147+
open_map(a: integer())
148+
)
149+
|> union(open_map(a: integer()))
138150
end
139151

140152
test "list" do

0 commit comments

Comments
 (0)