@@ -2,16 +2,14 @@ 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
+
5
7
setup do
6
8
alias ElixirLS.Utils.PacketCapture
7
9
packet_capture = start_supervised! ( { PacketCapture , self ( ) } )
8
10
Process . register ( packet_capture , :elixir_ls_test_process )
9
11
10
- pid =
11
- case WorkspaceSymbols . start_link ( [ ] ) do
12
- { :ok , pid } -> pid
13
- { :error , { :already_started , pid } } -> pid
14
- end
12
+ { :ok , pid } = WorkspaceSymbols . start_link ( name: @ server_name )
15
13
16
14
state = :sys . get_state ( pid )
17
15
@@ -31,19 +29,15 @@ defmodule ElixirLS.LanguageServer.Providers.WorkspaceSymbolsTest do
31
29
}
32
30
end )
33
31
34
- WorkspaceSymbols . notify_build_complete ( )
32
+ WorkspaceSymbols . notify_build_complete ( @ server_name )
35
33
36
34
wait_until_indexed ( pid )
37
35
38
- on_exit ( fn ->
39
- :sys . replace_state ( pid , fn _ -> state end )
40
- end )
41
-
42
36
{ :ok , % { } }
43
37
end
44
38
45
39
test "empty query" do
46
- assert { :ok , [ ] } == WorkspaceSymbols . symbols ( "" )
40
+ assert { :ok , [ ] } == WorkspaceSymbols . symbols ( "" , @ server_name )
47
41
48
42
assert_receive % {
49
43
"method" => "window/logMessage" ,
@@ -62,7 +56,7 @@ defmodule ElixirLS.LanguageServer.Providers.WorkspaceSymbolsTest do
62
56
} ,
63
57
name: "ElixirLS.LanguageServer.Fixtures.WorkspaceSymbols"
64
58
}
65
- ] } = WorkspaceSymbols . symbols ( "ElixirLS.LanguageServer.Fixtures." )
59
+ ] } = WorkspaceSymbols . symbols ( "ElixirLS.LanguageServer.Fixtures." , @ server_name )
66
60
67
61
assert uri |> String . ends_with? ( "test/support/fixtures/workspace_symbols.ex" )
68
62
@@ -76,7 +70,7 @@ defmodule ElixirLS.LanguageServer.Providers.WorkspaceSymbolsTest do
76
70
} ,
77
71
name: "ElixirLS.LanguageServer.Fixtures.WorkspaceSymbols"
78
72
}
79
- ] } = WorkspaceSymbols . symbols ( "work" )
73
+ ] } = WorkspaceSymbols . symbols ( "work" , @ server_name )
80
74
81
75
assert uri |> String . ends_with? ( "test/support/fixtures/workspace_symbols.ex" )
82
76
end
@@ -129,7 +123,7 @@ defmodule ElixirLS.LanguageServer.Providers.WorkspaceSymbolsTest do
129
123
name: "f ElixirLS.LanguageServer.Fixtures.WorkspaceSymbols.__info__/1"
130
124
}
131
125
]
132
- } = WorkspaceSymbols . symbols ( "f ElixirLS.LanguageServer.Fixtures." )
126
+ } = WorkspaceSymbols . symbols ( "f ElixirLS.LanguageServer.Fixtures." , @ server_name )
133
127
134
128
assert uri |> String . ends_with? ( "test/support/fixtures/workspace_symbols.ex" )
135
129
@@ -143,7 +137,7 @@ defmodule ElixirLS.LanguageServer.Providers.WorkspaceSymbolsTest do
143
137
} ,
144
138
name: "f ElixirLS.LanguageServer.Fixtures.WorkspaceSymbols.some_function/1"
145
139
}
146
- ] } = WorkspaceSymbols . symbols ( "f fun" )
140
+ ] } = WorkspaceSymbols . symbols ( "f fun" , @ server_name )
147
141
148
142
assert uri |> String . ends_with? ( "test/support/fixtures/workspace_symbols.ex" )
149
143
end
@@ -168,7 +162,7 @@ defmodule ElixirLS.LanguageServer.Providers.WorkspaceSymbolsTest do
168
162
name: "t ElixirLS.LanguageServer.Fixtures.WorkspaceSymbols.some_opaque_type/0"
169
163
}
170
164
]
171
- } = WorkspaceSymbols . symbols ( "t ElixirLS.LanguageServer.Fixtures." )
165
+ } = WorkspaceSymbols . symbols ( "t ElixirLS.LanguageServer.Fixtures." , @ server_name )
172
166
173
167
assert uri |> String . ends_with? ( "test/support/fixtures/workspace_symbols.ex" )
174
168
@@ -184,7 +178,7 @@ defmodule ElixirLS.LanguageServer.Providers.WorkspaceSymbolsTest do
184
178
name: "t ElixirLS.LanguageServer.Fixtures.WorkspaceSymbols.some_opaque_type/0"
185
179
}
186
180
]
187
- } = WorkspaceSymbols . symbols ( "t opa" )
181
+ } = WorkspaceSymbols . symbols ( "t opa" , @ server_name )
188
182
189
183
assert uri |> String . ends_with? ( "test/support/fixtures/workspace_symbols.ex" )
190
184
end
@@ -209,7 +203,7 @@ defmodule ElixirLS.LanguageServer.Providers.WorkspaceSymbolsTest do
209
203
name: "c ElixirLS.LanguageServer.Fixtures.WorkspaceSymbols.some_macrocallback/1"
210
204
}
211
205
]
212
- } = WorkspaceSymbols . symbols ( "c ElixirLS.LanguageServer.Fixtures." )
206
+ } = WorkspaceSymbols . symbols ( "c ElixirLS.LanguageServer.Fixtures." , @ server_name )
213
207
214
208
assert uri |> String . ends_with? ( "test/support/fixtures/workspace_symbols.ex" )
215
209
@@ -223,7 +217,7 @@ defmodule ElixirLS.LanguageServer.Providers.WorkspaceSymbolsTest do
223
217
} ,
224
218
name: "c ElixirLS.LanguageServer.Fixtures.WorkspaceSymbols.some_macrocallback/1"
225
219
}
226
- ] } = WorkspaceSymbols . symbols ( "c macr" )
220
+ ] } = WorkspaceSymbols . symbols ( "c macr" , @ server_name )
227
221
228
222
assert uri |> String . ends_with? ( "test/support/fixtures/workspace_symbols.ex" )
229
223
end
0 commit comments