Skip to content

Commit

Permalink
added test_maybe_match_expr_ann (WIP)
Browse files Browse the repository at this point in the history
  • Loading branch information
MarkoMin committed Nov 13, 2024
1 parent 46f1750 commit a4f56b9
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion lib/syntax_tools/test/syntax_tools_SUITE.erl
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@
wrapped_subtrees/1,
t_abstract_type/1,t_erl_parse_type/1,t_type/1,
t_epp_dodger/1,t_epp_dodger_clever/1,
t_comment_scan/1,t_prettypr/1,test_named_fun_bind_ann/1]).
t_comment_scan/1,t_prettypr/1,test_named_fun_bind_ann/1,
test_maybe_match_expr_ann/1]).

suite() -> [{ct_hooks,[ts_install_cth]}].

Expand Down Expand Up @@ -403,6 +404,17 @@ test_named_fun_bind_ann(Config) when is_list(Config) ->
{'bound',['Test']} = CBound,
{'free', []} = CFree.

test_maybe_match_expr_ann(Config) when is_list(Config) ->
MaybeMatch = erl_syntax:maybe_match_expr(
erl_syntax:atom(ok),
erl_syntax:variable('Test')),
Maybe = erl_syntax:maybe_expr([MaybeMatch]),
AnnT = erl_syntax_lib:annotate_bindings(Maybe, []),
[Env, Bound, Free] = erl_syntax:get_ann(AnnT),
{'env',[]} = Env,
{'bound',[]} = Bound,
{'free',[]} = Free.

test_files(Config) ->
DataDir = ?config(data_dir, Config),
[ filename:join(DataDir,Filename) || Filename <- test_files() ].
Expand Down

0 comments on commit a4f56b9

Please sign in to comment.