Skip to content

Commit

Permalink
Add test improvements to check for both no equal sign and no value
Browse files Browse the repository at this point in the history
  • Loading branch information
codeadict committed Mar 28, 2020
1 parent bfb2769 commit 7243437
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/clique_parser.erl
Original file line number Diff line number Diff line change
Expand Up @@ -372,8 +372,13 @@ parse_valid_args_and_flag_test() ->
%% All arguments must be of type k=v
parse_invalid_kv_arg_test() ->
Spec = spec(),
Args = ["ayo="],
?assertMatch({error, _}, parse({Spec, Args})).
%% Argument with equal sign and no value
ArgsNoVal = ["ayo="],
?assertMatch({error, {invalid_kv_arg, _}}, parse({Spec, ArgsNoVal})),
%% Argument without equal sign and no value
ArgsNoEqualAndNoVal = ["ayo"],
?assertMatch({error, {invalid_kv_arg, _}}, parse({Spec, ArgsNoEqualAndNoVal})).


%% This succeeds, because we aren't validating the flag, just parsing
%% Note: Short flags get parsed into tuples with their character as first elem
Expand Down

0 comments on commit 7243437

Please sign in to comment.