Increase JSON conversation coverage
This commit is contained in:
parent
9708fb23c8
commit
723bcdcb75
|
|
@ -29,10 +29,10 @@ convert_binary_values([{K, V}|T], Accum) when is_binary(V) ->
|
|||
convert_binary_values([{K, V}|T], Accum) ->
|
||||
convert_binary_values(T, lists:append(Accum, [{binary_to_list(K), V}]));
|
||||
convert_binary_values([H|T], Accum) when is_binary(H) ->
|
||||
convert_binary_values(T, lists:append(Accum, [binary_to_list(H)]));
|
||||
convert_binary_values(T, lists:append(Accum, [binary_to_list(H)]));
|
||||
convert_binary_values([H|T], Accum) when is_integer(H) ->
|
||||
convert_binary_values(T, lists:append(Accum, [H]));
|
||||
convert_binary_values(T, lists:append(Accum, [H]));
|
||||
convert_binary_values([H|T], Accum) when is_atom(H) ->
|
||||
convert_binary_values(T, lists:append(Accum, [H]));
|
||||
convert_binary_values(T, lists:append(Accum, [H]));
|
||||
convert_binary_values([H|T], Accum) ->
|
||||
convert_binary_values(T, lists:append(Accum, convert_binary_values(H, []))).
|
||||
|
|
|
|||
|
|
@ -48,6 +48,11 @@ parse_test_() ->
|
|||
{"key","aws:cloudformation:stack-name"},
|
||||
{"value","prod-us-east-1-ecs-1"}]}
|
||||
],
|
||||
?assertEqual(Expectation, httpc_aws_json:decode(Value))
|
||||
end},
|
||||
{"list values", fun() ->
|
||||
Value = "{\"misc\": [\"foo\", true, 123]\}",
|
||||
Expectation = [{"misc", ["foo", true, 123]}],
|
||||
?assertEqual(Expectation, httpc_aws_json:decode(Value))
|
||||
end}
|
||||
].
|
||||
|
|
|
|||
Loading…
Reference in New Issue