Fix warnings in test suites

This commit is contained in:
Ulf Norell 2019-09-23 12:17:22 +02:00
parent e645a8d034
commit 99ecda4b7b
2 changed files with 8 additions and 7 deletions

View File

@ -106,7 +106,7 @@ aci_test_contract(Name) ->
ok. ok.
check_stub(Stub, Options) -> check_stub(Stub, Options) ->
case aeso_parser:string(binary_to_list(Stub), Options) of try aeso_parser:string(binary_to_list(Stub), Options) of
Ast -> Ast ->
try try
%% io:format("AST: ~120p\n", [Ast]), %% io:format("AST: ~120p\n", [Ast]),
@ -117,9 +117,9 @@ check_stub(Stub, Options) ->
_:R -> _:R ->
io:format("Error: ~p\n", [R]), io:format("Error: ~p\n", [R]),
error(R) error(R)
end; end
{error, E} -> catch throw:{error, Errs} ->
io:format("Error: ~p\n", [E]), _ = [ io:format("~s\n", [aeso_errors:pp(E)]) || E <- Errs ],
error({parse_error, E}) error({parse_errors, Errs})
end. end.

View File

@ -4,6 +4,8 @@
-include_lib("eunit/include/eunit.hrl"). -include_lib("eunit/include/eunit.hrl").
id(X) -> X.
simple_contracts_test_() -> simple_contracts_test_() ->
{foreach, {foreach,
fun() -> ok end, fun() -> ok end,
@ -30,7 +32,7 @@ simple_contracts_test_() ->
end, end,
Parse = fun(S) -> Parse = fun(S) ->
try remove_line_numbers(parse_expr(S)) try remove_line_numbers(parse_expr(S))
catch _:_ -> ?assertMatch(ok, {parse_fail, S}) end catch _:_ -> ?assertMatch(ok, id({parse_fail, S})) end
end, end,
CheckParens = fun(Expr) -> CheckParens = fun(Expr) ->
?assertEqual(Parse(NoPar(Expr)), Parse(Par(Expr))) ?assertEqual(Parse(NoPar(Expr)), Parse(Par(Expr)))
@ -38,7 +40,6 @@ simple_contracts_test_() ->
LeftAssoc = fun(Op) -> CheckParens({{a, Op, b}, Op, c}) end, LeftAssoc = fun(Op) -> CheckParens({{a, Op, b}, Op, c}) end,
RightAssoc = fun(Op) -> CheckParens({a, Op, {b, Op, c}}) end, RightAssoc = fun(Op) -> CheckParens({a, Op, {b, Op, c}}) end,
NonAssoc = fun(Op) -> NonAssoc = fun(Op) ->
OpAtom = list_to_atom(Op),
?assertThrow({error, [_]}, ?assertThrow({error, [_]},
parse_expr(NoPar({a, Op, {b, Op, c}}))) end, parse_expr(NoPar({a, Op, {b, Op, c}}))) end,
Stronger = fun(Op1, Op2) -> Stronger = fun(Op1, Op2) ->