4545 gh11155 /1 ,
4646 t_comment_scan /1 ,t_prettypr /1 ,test_named_fun_bind_ann /1 ,
4747 test_maybe_expr_ann /1 ,test_mc_ann /1 ,test_zip_ann /1 ,
48- is_literal /1 ]).
48+ is_literal /1 , test_erl_recomment / 1 ]).
4949
5050suite () -> [{ct_hooks ,[ts_install_cth ]}].
5151
@@ -57,7 +57,7 @@ all() ->
5757 t_epp_dodger ,t_epp_dodger_clever ,gh11155 ,
5858 t_comment_scan ,t_prettypr ,test_named_fun_bind_ann ,
5959 test_maybe_expr_ann ,test_mc_ann ,test_zip_ann ,
60- is_literal ].
60+ is_literal , test_erl_recomment ].
6161
6262groups () ->
6363 [].
@@ -572,6 +572,26 @@ test_comment_scan([File|Files],DataDir) ->
572572 {ribbon , 110 }])),
573573 test_comment_scan (Files ,DataDir ).
574574
575+ test_erl_recomment (_Config ) ->
576+ Name = erl_syntax :atom (foo ),
577+ Comment = erl_comment_scan :string (" %% todo" ),
578+
579+ ExpectedComment = {attr ,0 ,[],{com ,[],[{tree ,comment ,{attr ,1 ,[],none },{comment ,0 ,[" % todo" ]}}]}},
580+ ExpectedResult = {tree ,atom , ExpectedComment , foo },
581+
582+ % % tests erl_recomment does not crash on non-formlist
583+ ExpectedResult = erl_recomment :recomment_forms (Name , Comment ),
584+
585+ % % test recomment does works on format list
586+ Args = [erl_syntax :abstract (X ) || X <- [1 , 2 , 3 ]],
587+ Attr = erl_syntax :attribute (Name , Args ),
588+
589+ {tree ,attribute ,
590+ ExpectedComment ,
591+ {attribute ,{tree ,atom ,{attr ,0 ,[],none },foo },
592+ [{tree ,integer ,{attr ,0 ,[],none },1 },
593+ {tree ,integer ,{attr ,0 ,[],none },2 },
594+ {tree ,integer ,{attr ,0 ,[],none },3 }]}} = erl_recomment :recomment_forms (Attr , Comment ).
575595
576596test_prettypr ([],_ ,_ ) -> ok ;
577597test_prettypr ([File |Files ],DataDir ,PrivDir ) ->
0 commit comments