Merge pull request #115 from dumbbell/honor-return_maps-option
jsx_to_term:parse_config/2: Honor `return_maps` option value
This commit is contained in:
commit
6a01f3a43b
1 changed files with 5 additions and 1 deletions
|
@ -88,7 +88,7 @@ parse_config([labels|Rest], Config) ->
|
|||
parse_config(Rest, Config#config{labels = binary});
|
||||
parse_config([{return_maps, Val}|Rest], Config)
|
||||
when Val == true; Val == false ->
|
||||
parse_config(Rest, Config#config{return_maps = true});
|
||||
parse_config(Rest, Config#config{return_maps = Val});
|
||||
parse_config([return_maps|Rest], Config) ->
|
||||
parse_config(Rest, Config#config{return_maps = true});
|
||||
parse_config([{K, _}|Rest] = Options, Config) ->
|
||||
|
@ -424,6 +424,10 @@ return_maps_test_() ->
|
|||
[{}],
|
||||
jsx:decode(<<"{}">>, [])
|
||||
)},
|
||||
{"an empty map", ?_assertEqual(
|
||||
[{}],
|
||||
jsx:decode(<<"{}">>, [{return_maps, false}])
|
||||
)},
|
||||
{"a small map", ?_assertEqual(
|
||||
#{<<"awesome">> => true, <<"library">> => <<"jsx">>},
|
||||
jsx:decode(<<"{\"library\": \"jsx\", \"awesome\": true}">>, [return_maps])
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue