@@ -17,13 +17,23 @@ defmodule ElixirLS.LanguageServer.TracerTest do
17
17
assert GenServer . call ( Tracer , :get_project_dir ) == project_path
18
18
end
19
19
20
+ test "set deps path" do
21
+ project_path = FixtureHelpers . get_path ( "" )
22
+ deps_path = Path . join ( project_path , "deps" )
23
+
24
+ Tracer . notify_deps_path ( deps_path )
25
+
26
+ assert GenServer . call ( Tracer , :get_deps_path ) == deps_path
27
+ end
28
+
20
29
describe "call trace" do
21
30
setup context do
22
31
project_path = FixtureHelpers . get_path ( "" )
23
32
Tracer . notify_settings_stored ( project_path )
33
+ Tracer . notify_deps_path ( Path . join ( project_path , "deps" ) )
24
34
GenServer . call ( Tracer , :get_project_dir )
25
35
26
- { :ok , context }
36
+ { :ok , context |> Map . put ( :project_path , project_path ) }
27
37
end
28
38
29
39
defp sorted_calls ( ) do
@@ -34,99 +44,101 @@ defmodule ElixirLS.LanguageServer.TracerTest do
34
44
assert sorted_calls ( ) == [ ]
35
45
end
36
46
37
- test "registers calls same function different files" do
47
+ test "registers calls same function different files" , % { project_path: project_path } do
38
48
Tracer . trace (
39
49
{ :remote_function , [ line: 12 , column: 2 ] , CalledModule , :called , 1 } ,
40
50
% Macro.Env {
41
51
module: CallingModule ,
42
- file: "calling_module.ex"
52
+ file: Path . join ( project_path , "calling_module.ex" )
43
53
}
44
54
)
45
55
46
56
Tracer . trace (
47
57
{ :remote_function , [ line: 13 , column: 3 ] , CalledModule , :called , 1 } ,
48
58
% Macro.Env {
49
59
module: OtherCallingModule ,
50
- file: "other_calling_module.ex"
60
+ file: Path . join ( project_path , "other_calling_module.ex" )
51
61
}
52
62
)
53
63
54
64
assert [
55
- { { CalledModule , :called , 1 } , "calling_module.ex" , 12 , 2 } ,
56
- { { CalledModule , :called , 1 } , "other_calling_module.ex" , 13 , 3 }
65
+ { { CalledModule , :called , 1 } , Path . join ( project_path , "calling_module.ex" ) , 12 , 2 } ,
66
+ { { CalledModule , :called , 1 } , Path . join ( project_path , "other_calling_module.ex" ) ,
67
+ 13 , 3 }
57
68
] == sorted_calls ( )
58
69
end
59
70
60
- test "registers calls same function in one file" do
71
+ test "registers calls same function in one file" , % { project_path: project_path } do
61
72
Tracer . trace (
62
73
{ :remote_function , [ line: 12 , column: 2 ] , CalledModule , :called , 1 } ,
63
74
% Macro.Env {
64
75
module: CallingModule ,
65
- file: "calling_module.ex"
76
+ file: Path . join ( project_path , "calling_module.ex" )
66
77
}
67
78
)
68
79
69
80
Tracer . trace (
70
81
{ :remote_function , [ line: 13 , column: 3 ] , CalledModule , :called , 1 } ,
71
82
% Macro.Env {
72
83
module: CallingModule ,
73
- file: "calling_module.ex"
84
+ file: Path . join ( project_path , "calling_module.ex" )
74
85
}
75
86
)
76
87
77
88
assert [
78
- { { CalledModule , :called , 1 } , "calling_module.ex" , 12 , 2 } ,
79
- { { CalledModule , :called , 1 } , "calling_module.ex" , 13 , 3 }
89
+ { { CalledModule , :called , 1 } , Path . join ( project_path , "calling_module.ex" ) , 12 , 2 } ,
90
+ { { CalledModule , :called , 1 } , Path . join ( project_path , "calling_module.ex" ) , 13 , 3 }
80
91
] == sorted_calls ( )
81
92
end
82
93
83
- test "registers calls different functions" do
94
+ test "registers calls different functions" , % { project_path: project_path } do
84
95
Tracer . trace (
85
96
{ :remote_function , [ line: 12 , column: 2 ] , CalledModule , :called , 1 } ,
86
97
% Macro.Env {
87
98
module: CallingModule ,
88
- file: "calling_module.ex"
99
+ file: Path . join ( project_path , "calling_module.ex" )
89
100
}
90
101
)
91
102
92
103
Tracer . trace (
93
104
{ :remote_function , [ line: 13 , column: 3 ] , CalledModule , :other_called , 1 } ,
94
105
% Macro.Env {
95
106
module: OtherCallingModule ,
96
- file: "other_calling_module.ex"
107
+ file: Path . join ( project_path , "other_calling_module.ex" )
97
108
}
98
109
)
99
110
100
111
assert [
101
- { { CalledModule , :called , 1 } , "calling_module.ex" , 12 , 2 } ,
102
- { { CalledModule , :other_called , 1 } , "other_calling_module.ex" , 13 , 3 }
112
+ { { CalledModule , :called , 1 } , Path . join ( project_path , "calling_module.ex" ) , 12 , 2 } ,
113
+ { { CalledModule , :other_called , 1 } ,
114
+ Path . join ( project_path , "other_calling_module.ex" ) , 13 , 3 }
103
115
] == sorted_calls ( )
104
116
end
105
117
106
- test "deletes calls by file" do
118
+ test "deletes calls by file" , % { project_path: project_path } do
107
119
Tracer . trace (
108
120
{ :remote_function , [ line: 12 , column: 2 ] , CalledModule , :called , 1 } ,
109
121
% Macro.Env {
110
122
module: CallingModule ,
111
- file: "calling_module.ex"
123
+ file: Path . join ( project_path , "calling_module.ex" )
112
124
}
113
125
)
114
126
115
127
Tracer . trace (
116
128
{ :remote_function , [ line: 13 , column: 3 ] , CalledModule , :called , 1 } ,
117
129
% Macro.Env {
118
130
module: OtherCallingModule ,
119
- file: "other_calling_module.ex"
131
+ file: Path . join ( project_path , "other_calling_module.ex" )
120
132
}
121
133
)
122
134
123
- Tracer . delete_calls_by_file ( "other_calling_module.ex" )
135
+ Tracer . delete_calls_by_file ( Path . join ( project_path , "other_calling_module.ex" ) )
124
136
125
137
assert [
126
- { { CalledModule , :called , 1 } , "calling_module.ex" , 12 , 2 }
138
+ { { CalledModule , :called , 1 } , Path . join ( project_path , "calling_module.ex" ) , 12 , 2 }
127
139
] == sorted_calls ( )
128
140
129
- Tracer . delete_calls_by_file ( "calling_module.ex" )
141
+ Tracer . delete_calls_by_file ( Path . join ( project_path , "calling_module.ex" ) )
130
142
131
143
assert [ ] == sorted_calls ( )
132
144
end
0 commit comments