Skip to content

Commit

Permalink
Fix mochijson2 test that was map-order dependent
Browse files Browse the repository at this point in the history
  • Loading branch information
etrepum committed Mar 21, 2024
1 parent 4b03d12 commit be68a43
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/mochijson2.erl
Original file line number Diff line number Diff line change
Expand Up @@ -966,8 +966,9 @@ decode_map_test() ->
?assertEqual(M, decode(Json, [{format, map}])).

encode_map_test() ->
M = <<"{\"a\":1,\"b\":{\"c\":2}}">>,
?assertEqual(M, iolist_to_binary(encode(#{a => 1, b => #{ c => 2}}))).
?assertEqual(<<"{\"a\":1}">>, iolist_to_binary(encode(#{a => 1}))),
M = #{<<"a">> => 1, <<"b">> => #{<<"c">> => 2}},
?assertEqual(M, decode(iolist_to_binary(encode(#{a => 1, b => #{ c => 2}})), [{format, map}])).

encode_empty_map_test() ->
?assertEqual(<<"{}">>, encode(#{})).
Expand Down

0 comments on commit be68a43

Please sign in to comment.