Skip to content

Commit 506f654

Browse files
committed
fix tests
1 parent b7b62ba commit 506f654

File tree

3 files changed

+16
-46
lines changed

3 files changed

+16
-46
lines changed

apps/language_server/test/providers/execute_command/llm_definition_test.exs

Lines changed: 13 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -30,14 +30,7 @@ defmodule ElixirLS.LanguageServer.Providers.ExecuteCommand.LlmDefinitionTest do
3030
assert {:ok, response} = result
3131

3232
# String module is built-in, so location might not be found
33-
assert response[:definition] || response[:error]
34-
35-
if response[:error] do
36-
assert response.error =~ "Module String not found" ||
37-
response.error =~ "Cannot read file"
38-
else
39-
assert response.definition =~ "Definition found in"
40-
end
33+
assert response[:definition]
4134
end
4235

4336
test "handles nested module symbol" do
@@ -49,70 +42,53 @@ defmodule ElixirLS.LanguageServer.Providers.ExecuteCommand.LlmDefinitionTest do
4942
)
5043

5144
assert {:ok, response} = result
52-
assert response[:definition] || response[:error]
45+
assert response[:definition]
5346
end
5447

5548
test "handles Erlang module symbol" do
5649
result = LlmDefinition.execute([":lists"], %{})
5750

5851
assert {:ok, response} = result
5952
# Erlang modules may or may not have source available depending on the system
60-
assert response[:definition] || response[:error]
53+
assert response[:definition]
6154

62-
if response[:error] do
63-
assert response.error =~ "Erlang module :lists not found" ||
64-
response.error =~ "Cannot read file"
65-
else
66-
# If source is found, it should contain the module name
67-
assert response.definition =~ "lists"
68-
end
55+
# If source is found, it should contain the module name
56+
assert response.definition =~ "lists"
6957
end
7058

7159
test "handles function with arity" do
7260
result = LlmDefinition.execute(["String.split/2"], %{})
7361

7462
assert {:ok, response} = result
75-
assert response[:definition] || response[:error]
63+
assert response[:definition]
7664
end
7765

7866
test "handles function without arity" do
7967
result = LlmDefinition.execute(["String.split"], %{})
8068

8169
assert {:ok, response} = result
82-
assert response[:definition] || response[:error]
70+
assert response[:definition]
8371
end
8472

8573
test "handles function with invalid arity" do
8674
result = LlmDefinition.execute(["String.split/99"], %{})
8775

8876
assert {:ok, response} = result
89-
# V2 parser may successfully parse this and either find the module or specific function
90-
# Both outcomes are acceptable - either error or success with definition
91-
assert response[:error] || response[:definition]
92-
93-
if response[:error] do
94-
assert response.error =~ "Function" && response.error =~ "split/99 not found"
95-
end
77+
assert response[:definition]
9678
end
9779

9880
test "handles special function names with ?" do
9981
result = LlmDefinition.execute(["String.valid?/1"], %{})
10082

10183
assert {:ok, response} = result
102-
assert response[:definition] || response[:error]
84+
assert response[:definition]
10385
end
10486

10587
test "handles special function names with !" do
10688
result = LlmDefinition.execute(["String.upcase!/1"], %{})
10789

10890
assert {:ok, response} = result
109-
# V2 parser may successfully parse this and either find the module or specific function
110-
# Both outcomes are acceptable - either error or success with definition
111-
assert response[:error] || response[:definition]
112-
113-
if response[:error] do
114-
assert response.error =~ "Function" && response.error =~ "upcase!/1 not found"
115-
end
91+
assert response[:definition]
11692
end
11793

11894
test "handles internal errors gracefully" do
@@ -127,13 +103,6 @@ defmodule ElixirLS.LanguageServer.Providers.ExecuteCommand.LlmDefinitionTest do
127103
end
128104

129105
describe "edge cases" do
130-
test "handles module names with numbers" do
131-
result = LlmDefinition.execute(["Base64"], %{})
132-
133-
assert {:ok, response} = result
134-
assert response[:definition] || response[:error]
135-
end
136-
137106
test "handles deeply nested modules" do
138107
result = LlmDefinition.execute(["A.B.C.D.E"], %{})
139108

@@ -149,7 +118,7 @@ defmodule ElixirLS.LanguageServer.Providers.ExecuteCommand.LlmDefinitionTest do
149118
result = LlmDefinition.execute([":erlang"], %{})
150119

151120
assert {:ok, response} = result
152-
assert response[:definition] || response[:error]
121+
assert response[:definition]
153122
end
154123

155124
test "rejects invalid erlang module format" do
@@ -224,7 +193,7 @@ defmodule ElixirLS.LanguageServer.Providers.ExecuteCommand.LlmDefinitionTest do
224193
assert {:ok, response} = result
225194

226195
# Should find the function even without specifying arity
227-
assert response[:definition] || response[:error]
196+
assert response[:definition]
228197
end
229198

230199
test "handles function with multiple arities" do
@@ -237,7 +206,7 @@ defmodule ElixirLS.LanguageServer.Providers.ExecuteCommand.LlmDefinitionTest do
237206
assert {:ok, response} = result
238207

239208
# Should find one of the arities
240-
assert response[:definition] || response[:error]
209+
assert response[:definition]
241210
end
242211
end
243212

apps/language_server/test/providers/execute_command/llm_implementation_finder_test.exs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,8 @@ defmodule ElixirLS.LanguageServer.Providers.ExecuteCommand.LlmImplementationFind
4747

4848
test "finds protocol implementations by protocol name" do
4949
# Enumerable is a well-known protocol
50-
assert {:ok, result} = LlmImplementationFinder.execute(["Enumerable"], %{})
50+
assert {:ok, result} =
51+
LlmImplementationFinder.execute(["ElixirSenseExample.ExampleProtocol"], %{})
5152

5253
assert Map.has_key?(result, :implementations)
5354
assert is_list(result.implementations)

apps/language_server/test/providers/formatting_test.exs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -514,7 +514,7 @@ defmodule ElixirLS.LanguageServer.Providers.FormattingTest do
514514
source_file = %SourceFile{text: "foo 1", version: 1, dirty?: true}
515515
uri = SourceFile.Path.to_uri(path)
516516

517-
assert {:ok, edits} = Formatting.format(source_file, uri, project_dir, true)
517+
assert {:ok, edits} = Formatting.format(source_file, uri, project_dir, true)
518518
assert length(edits) >= 1
519519

520520
assert {:ok, []} =

0 commit comments

Comments
 (0)