proper
proper copied to clipboard
Support for `map`s
As Kostis mentioned back in 2015, at some point, Proper needs to support maps.
For me that point is today. Would a PR for a map generator be accepted? Do you have rules or guidelines regarding your code preferences somewhere?
For others, while we wait, here are a few utility functions that have been serving me modestly well, although they're quite limited:
gen_map() ->
?LET(L, list({term(), term()}), maps:from_list(L)).
gen_nonempty_map() ->
?SUCHTHAT(M, gen_map(), M =/= #{}).
gen_nonempty_map_without_key(K) ->
?SUCHTHAT(M, gen_map(), M =/= #{} andalso (maps:find(K, M) =:= error)).