diff --git a/test/aeso_aci_tests.erl b/test/aeso_aci_tests.erl index ec6737c..d5010e3 100644 --- a/test/aeso_aci_tests.erl +++ b/test/aeso_aci_tests.erl @@ -106,7 +106,7 @@ aci_test_contract(Name) -> ok. 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 -> try %% io:format("AST: ~120p\n", [Ast]), @@ -117,9 +117,9 @@ check_stub(Stub, Options) -> _:R -> io:format("Error: ~p\n", [R]), error(R) - end; - {error, E} -> - io:format("Error: ~p\n", [E]), - error({parse_error, E}) + end + catch throw:{error, Errs} -> + _ = [ io:format("~s\n", [aeso_errors:pp(E)]) || E <- Errs ], + error({parse_errors, Errs}) end. diff --git a/test/aeso_parser_tests.erl b/test/aeso_parser_tests.erl index 6b2fc5c..ab585f3 100644 --- a/test/aeso_parser_tests.erl +++ b/test/aeso_parser_tests.erl @@ -4,6 +4,8 @@ -include_lib("eunit/include/eunit.hrl"). +id(X) -> X. + simple_contracts_test_() -> {foreach, fun() -> ok end, @@ -30,7 +32,7 @@ simple_contracts_test_() -> end, Parse = fun(S) -> try remove_line_numbers(parse_expr(S)) - catch _:_ -> ?assertMatch(ok, {parse_fail, S}) end + catch _:_ -> ?assertMatch(ok, id({parse_fail, S})) end end, CheckParens = fun(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, RightAssoc = fun(Op) -> CheckParens({a, Op, {b, Op, c}}) end, NonAssoc = fun(Op) -> - OpAtom = list_to_atom(Op), ?assertThrow({error, [_]}, parse_expr(NoPar({a, Op, {b, Op, c}}))) end, Stronger = fun(Op1, Op2) ->