intermediate commit on way to eunit
This commit is contained in:
parent
57c85a4185
commit
ca1d605e95
2 changed files with 6 additions and 4 deletions
|
@ -243,10 +243,10 @@ load_tests([Test|Rest], Dir, Acc) ->
|
|||
end.
|
||||
|
||||
|
||||
%% if the json, erlang or jsx values are lists, assume they're a path to a file that should
|
||||
%% if the json, eep0018 or jsx values are lists, assume they're a path to a file that should
|
||||
%% be read with file:read_file/1
|
||||
parse_test([{Key, Path}|Rest], Test) when is_list(Path) ->
|
||||
case lists:member(Key, [json, erlang, jsx]) of
|
||||
case lists:member(Key, [json, eep0018, jsx]) of
|
||||
true ->
|
||||
case file:read_file(Path) of
|
||||
{ok, Bin} -> parse_test(Rest, [{Key, Bin}] ++ Test)
|
||||
|
|
|
@ -65,6 +65,7 @@ term_to_events(Term) ->
|
|||
proplist_to_events([{Key, Term}|Rest], Acc) ->
|
||||
Event = term_to_event(Term),
|
||||
EncodedKey = key_to_event(Key),
|
||||
io:format("~p~n~p~n~n", [EncodedKey, Acc]),
|
||||
case key_repeats(EncodedKey, Acc) of
|
||||
false -> proplist_to_events(Rest, Event ++ EncodedKey ++ Acc)
|
||||
; true -> erlang:error(badarg)
|
||||
|
@ -101,9 +102,10 @@ key_to_event(Key) when is_binary(Key) ->
|
|||
[{key, json_escape(Key)}].
|
||||
|
||||
|
||||
key_repeats([Key], [Key|_]) -> true;
|
||||
key_repeats([{key, Key}], [{key, Key}|_Rest]) -> true;
|
||||
key_repeats(Key, [{Key, _Value}|_Rest]) -> true;
|
||||
key_repeats(Key, [_|Rest]) -> key_repeats(Key, Rest);
|
||||
key_repeats(_, []) -> false.
|
||||
key_repeats(_Key, []) -> false.
|
||||
|
||||
|
||||
%% conversion of floats to 'nice' decimal output. erlang's float implementation is almost
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue