aboutsummaryrefslogtreecommitdiffstats
path: root/erts/emulator/test/map_SUITE.erl
diff options
context:
space:
mode:
authorBjörn-Egil Dahlberg <[email protected]>2015-04-09 13:43:46 +0200
committerBjörn-Egil Dahlberg <[email protected]>2015-04-09 13:43:46 +0200
commit8da670fa275d77119e32bf642edb342b5dd64dc9 (patch)
treea306b1f82546888f488026c2f6e821bf562795ca /erts/emulator/test/map_SUITE.erl
parent26c94c98a598a312b7912b1ef7ae3a7b01abcbf1 (diff)
downloadotp-8da670fa275d77119e32bf642edb342b5dd64dc9.tar.gz
otp-8da670fa275d77119e32bf642edb342b5dd64dc9.tar.bz2
otp-8da670fa275d77119e32bf642edb342b5dd64dc9.zip
erts: Test maps:from_list/1 shrinking
Repeated keys will shrink map to a flatmap if the number of pairs drops below the limit.
Diffstat (limited to 'erts/emulator/test/map_SUITE.erl')
-rw-r--r--erts/emulator/test/map_SUITE.erl7
1 files changed, 7 insertions, 0 deletions
diff --git a/erts/emulator/test/map_SUITE.erl b/erts/emulator/test/map_SUITE.erl
index dc6286fdb6..fbe6ea2a38 100644
--- a/erts/emulator/test/map_SUITE.erl
+++ b/erts/emulator/test/map_SUITE.erl
@@ -2252,6 +2252,13 @@ t_bif_map_from_list(Config) when is_list(Config) ->
maps:from_list([ {{hi,3},v3}, {"hi",v0},{3,v1}, {<<"hi">>,v4}, {hi,v2},
{<<"hi">>,v6}, {{hi,3},v10},{"hi",v11}, {hi,v9}, {3,v8}]),
+ %% repeated keys (large -> small)
+ Ps1 = [{a,I}|| I <- lists:seq(1,32)],
+ Ps2 = [{a,I}|| I <- lists:seq(33,64)],
+
+ M = maps:from_list(Ps1 ++ [{b,1},{c,1}] ++ Ps2),
+ #{ a := 64, b := 1, c := 1 } = M,
+
%% error cases
{'EXIT', {badarg,_}} = (catch maps:from_list(id([{a,b},b]))),
{'EXIT', {badarg,_}} = (catch maps:from_list(id([{a,b},{b,b,3}]))),