@@ -2,14 +2,12 @@ defmodule ElixirLS.LanguageServer.Providers.WorkspaceSymbolsTest do
2
2
use ExUnit.Case , async: false
3
3
alias ElixirLS.LanguageServer.Providers.WorkspaceSymbols
4
4
5
- @ server_name WorkspaceSymbolsTestServer
6
-
7
5
setup do
8
6
alias ElixirLS.Utils.PacketCapture
9
7
packet_capture = start_supervised! ( { PacketCapture , self ( ) } )
10
- Process . register ( packet_capture , :elixir_ls_test_process )
11
8
12
- { :ok , pid } = WorkspaceSymbols . start_link ( name: @ server_name )
9
+ { :ok , pid } = WorkspaceSymbols . start_link ( name: nil )
10
+ Process . group_leader ( pid , packet_capture )
13
11
14
12
state = :sys . get_state ( pid )
15
13
@@ -29,23 +27,23 @@ defmodule ElixirLS.LanguageServer.Providers.WorkspaceSymbolsTest do
29
27
}
30
28
end )
31
29
32
- WorkspaceSymbols . notify_build_complete ( @ server_name )
30
+ WorkspaceSymbols . notify_build_complete ( pid )
33
31
34
32
wait_until_indexed ( pid )
35
33
36
- { :ok , % { } }
34
+ { :ok , server: pid }
37
35
end
38
36
39
- test "empty query" do
40
- assert { :ok , [ ] } == WorkspaceSymbols . symbols ( "" , @ server_name )
37
+ test "empty query" , % { server: server } do
38
+ assert { :ok , [ ] } == WorkspaceSymbols . symbols ( "" , server )
41
39
42
40
assert_receive % {
43
41
"method" => "window/logMessage" ,
44
42
"params" => % { "message" => "[ElixirLS WorkspaceSymbols] Updating index..." }
45
43
}
46
44
end
47
45
48
- test "returns modules" do
46
+ test "returns modules" , % { server: server } do
49
47
assert { :ok ,
50
48
[
51
49
% {
@@ -56,7 +54,7 @@ defmodule ElixirLS.LanguageServer.Providers.WorkspaceSymbolsTest do
56
54
} ,
57
55
name: "ElixirLS.LanguageServer.Fixtures.WorkspaceSymbols"
58
56
}
59
- ] } = WorkspaceSymbols . symbols ( "ElixirLS.LanguageServer.Fixtures." , @ server_name )
57
+ ] } = WorkspaceSymbols . symbols ( "ElixirLS.LanguageServer.Fixtures." , server )
60
58
61
59
assert uri |> String . ends_with? ( "test/support/fixtures/workspace_symbols.ex" )
62
60
@@ -70,12 +68,12 @@ defmodule ElixirLS.LanguageServer.Providers.WorkspaceSymbolsTest do
70
68
} ,
71
69
name: "ElixirLS.LanguageServer.Fixtures.WorkspaceSymbols"
72
70
}
73
- ] } = WorkspaceSymbols . symbols ( "work" , @ server_name )
71
+ ] } = WorkspaceSymbols . symbols ( "work" , server )
74
72
75
73
assert uri |> String . ends_with? ( "test/support/fixtures/workspace_symbols.ex" )
76
74
end
77
75
78
- test "returns functions" do
76
+ test "returns functions" , % { server: server } do
79
77
assert {
80
78
:ok ,
81
79
[
@@ -123,7 +121,7 @@ defmodule ElixirLS.LanguageServer.Providers.WorkspaceSymbolsTest do
123
121
name: "f ElixirLS.LanguageServer.Fixtures.WorkspaceSymbols.__info__/1"
124
122
}
125
123
]
126
- } = WorkspaceSymbols . symbols ( "f ElixirLS.LanguageServer.Fixtures." , @ server_name )
124
+ } = WorkspaceSymbols . symbols ( "f ElixirLS.LanguageServer.Fixtures." , server )
127
125
128
126
assert uri |> String . ends_with? ( "test/support/fixtures/workspace_symbols.ex" )
129
127
@@ -137,12 +135,12 @@ defmodule ElixirLS.LanguageServer.Providers.WorkspaceSymbolsTest do
137
135
} ,
138
136
name: "f ElixirLS.LanguageServer.Fixtures.WorkspaceSymbols.some_function/1"
139
137
}
140
- ] } = WorkspaceSymbols . symbols ( "f fun" , @ server_name )
138
+ ] } = WorkspaceSymbols . symbols ( "f fun" , server )
141
139
142
140
assert uri |> String . ends_with? ( "test/support/fixtures/workspace_symbols.ex" )
143
141
end
144
142
145
- test "returns types" do
143
+ test "returns types" , % { server: server } do
146
144
assert {
147
145
:ok ,
148
146
[
@@ -162,7 +160,7 @@ defmodule ElixirLS.LanguageServer.Providers.WorkspaceSymbolsTest do
162
160
name: "t ElixirLS.LanguageServer.Fixtures.WorkspaceSymbols.some_opaque_type/0"
163
161
}
164
162
]
165
- } = WorkspaceSymbols . symbols ( "t ElixirLS.LanguageServer.Fixtures." , @ server_name )
163
+ } = WorkspaceSymbols . symbols ( "t ElixirLS.LanguageServer.Fixtures." , server )
166
164
167
165
assert uri |> String . ends_with? ( "test/support/fixtures/workspace_symbols.ex" )
168
166
@@ -178,12 +176,12 @@ defmodule ElixirLS.LanguageServer.Providers.WorkspaceSymbolsTest do
178
176
name: "t ElixirLS.LanguageServer.Fixtures.WorkspaceSymbols.some_opaque_type/0"
179
177
}
180
178
]
181
- } = WorkspaceSymbols . symbols ( "t opa" , @ server_name )
179
+ } = WorkspaceSymbols . symbols ( "t opa" , server )
182
180
183
181
assert uri |> String . ends_with? ( "test/support/fixtures/workspace_symbols.ex" )
184
182
end
185
183
186
- test "returns callbacks" do
184
+ test "returns callbacks" , % { server: server } do
187
185
assert {
188
186
:ok ,
189
187
[
@@ -203,7 +201,7 @@ defmodule ElixirLS.LanguageServer.Providers.WorkspaceSymbolsTest do
203
201
name: "c ElixirLS.LanguageServer.Fixtures.WorkspaceSymbols.some_macrocallback/1"
204
202
}
205
203
]
206
- } = WorkspaceSymbols . symbols ( "c ElixirLS.LanguageServer.Fixtures." , @ server_name )
204
+ } = WorkspaceSymbols . symbols ( "c ElixirLS.LanguageServer.Fixtures." , server )
207
205
208
206
assert uri |> String . ends_with? ( "test/support/fixtures/workspace_symbols.ex" )
209
207
@@ -217,7 +215,7 @@ defmodule ElixirLS.LanguageServer.Providers.WorkspaceSymbolsTest do
217
215
} ,
218
216
name: "c ElixirLS.LanguageServer.Fixtures.WorkspaceSymbols.some_macrocallback/1"
219
217
}
220
- ] } = WorkspaceSymbols . symbols ( "c macr" , @ server_name )
218
+ ] } = WorkspaceSymbols . symbols ( "c macr" , server )
221
219
222
220
assert uri |> String . ends_with? ( "test/support/fixtures/workspace_symbols.ex" )
223
221
end
0 commit comments