10
10
all /0 ,
11
11
xref_test /1 ,
12
12
xref_ignore_test /1 ,
13
+ xref_queries_test /1 ,
13
14
xref_dep_hook /1 ,
14
15
xref_undef_behaviour /1 ]).
15
16
@@ -39,6 +40,12 @@ init_per_testcase(xref_dep_hook, Config) ->
39
40
,{global_rebar_dir , GlobalDir }
40
41
,{root_dir , Dst }]),
41
42
[{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 ];
42
49
init_per_testcase (Case , Config ) ->
43
50
UpdConfig = rebar_test_utils :init_rebar_state (Config ),
44
51
AppDir = ? config (apps , UpdConfig ),
@@ -61,7 +68,8 @@ end_per_testcase(_, _Config) ->
61
68
ok .
62
69
63
70
all () ->
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 ].
65
73
66
74
% % ===================================================================
67
75
% % Test cases
@@ -75,6 +83,16 @@ xref_test(Config) ->
75
83
Result = rebar3 :run (rebar_state :new (State , RebarConfig , AppDir ), [" xref" ]),
76
84
verify_results (xref_test , Name , Result ).
77
85
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
+
78
96
xref_ignore_test (Config ) ->
79
97
AppDir = ? config (apps , Config ),
80
98
State = ? config (state , Config ),
0 commit comments