Skip to content

Commit d5e43c2

Browse files
committed
Don't rely on the order of lists returned by maps
For reference: ``` OTP-18414 Application(s): erts, stdlib Related Id(s): PR-6151 *** HIGHLIGHT *** Some map operations have been optimized by changing the internal sort order of atom keys. This changes the (undocumented) order of how atom keys in small maps are printed and returned by maps:to_list/1 and maps:next/1. The new order is unpredictable and may change between different invocations of the Erlang VM. ```
1 parent f206409 commit d5e43c2

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

src/ra_monitors.erl

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -135,10 +135,11 @@ basics_test() ->
135135
M1 = add(self(), machine, M0),
136136
[machine] = components(self(), M1),
137137
M2 = add(self(), aux, M1),
138-
[aux, machine] = components(self(), M2),
138+
[aux, machine] = lists:sort(components(self(), M2)),
139139
M3 = remove(self(), machine, M2),
140140
[aux] = components(self(), M3),
141-
{[aux, machine], M5} = handle_down(self(), M2),
141+
{Components, M5} = handle_down(self(), M2),
142+
[aux, machine] = lists:sort(Components),
142143
[] = components(self(), M5),
143144
ok.
144145

0 commit comments

Comments
 (0)