1010 all /0 ,
1111 xref_test /1 ,
1212 xref_ignore_test /1 ,
13+ xref_queries_test /1 ,
1314 xref_dep_hook /1 ,
1415 xref_undef_behaviour /1 ]).
1516
@@ -39,6 +40,12 @@ init_per_testcase(xref_dep_hook, Config) ->
3940 ,{global_rebar_dir , GlobalDir }
4041 ,{root_dir , Dst }]),
4142 [{apps , Dst }, {state , State } | Config ];
43+ init_per_testcase (xref_queries_test , Config ) ->
44+ UpdConfig = rebar_test_utils :init_rebar_state (Config ),
45+ AppDir = ? config (apps , UpdConfig ),
46+ Src = filename :join ([? config (data_dir , Config ), " recursive" , " apps" ]),
47+ ok = rebar_file_utils :cp_r ([Src ], AppDir ),
48+ [{apps , AppDir } | UpdConfig ];
4249init_per_testcase (Case , Config ) ->
4350 UpdConfig = rebar_test_utils :init_rebar_state (Config ),
4451 AppDir = ? config (apps , UpdConfig ),
@@ -61,7 +68,8 @@ end_per_testcase(_, _Config) ->
6168 ok .
6269
6370all () ->
64- [xref_test , xref_ignore_test , xref_dep_hook , xref_undef_behaviour ].
71+ [xref_test , xref_ignore_test , xref_dep_hook , xref_undef_behaviour ,
72+ xref_queries_test ].
6573
6674% % ===================================================================
6775% % Test cases
@@ -75,6 +83,16 @@ xref_test(Config) ->
7583 Result = rebar3 :run (rebar_state :new (State , RebarConfig , AppDir ), [" xref" ]),
7684 verify_results (xref_test , Name , Result ).
7785
86+ xref_queries_test (Config ) ->
87+ AppDir = ? config (apps , Config ),
88+ State = ? config (state , Config ),
89+ RebarConfig = [{erl_opts , [debug_info ]},
90+ {xref_queries , [{" A" , [rebar_issue1 , rebar_issue2 ]},
91+ {" (Fun) rebar_issue1 -> rebar_issue2" , []}
92+ ]}],
93+ {ok , _ } = rebar3 :run (rebar_state :new (State , RebarConfig , AppDir ), [" xref" ]),
94+ ok .
95+
7896xref_ignore_test (Config ) ->
7997 AppDir = ? config (apps , Config ),
8098 State = ? config (state , Config ),
0 commit comments