@@ -30,14 +30,7 @@ defmodule ElixirLS.LanguageServer.Providers.ExecuteCommand.LlmDefinitionTest do
30
30
assert { :ok , response } = result
31
31
32
32
# 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 ]
41
34
end
42
35
43
36
test "handles nested module symbol" do
@@ -49,70 +42,53 @@ defmodule ElixirLS.LanguageServer.Providers.ExecuteCommand.LlmDefinitionTest do
49
42
)
50
43
51
44
assert { :ok , response } = result
52
- assert response [ :definition ] || response [ :error ]
45
+ assert response [ :definition ]
53
46
end
54
47
55
48
test "handles Erlang module symbol" do
56
49
result = LlmDefinition . execute ( [ ":lists" ] , % { } )
57
50
58
51
assert { :ok , response } = result
59
52
# Erlang modules may or may not have source available depending on the system
60
- assert response [ :definition ] || response [ :error ]
53
+ assert response [ :definition ]
61
54
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"
69
57
end
70
58
71
59
test "handles function with arity" do
72
60
result = LlmDefinition . execute ( [ "String.split/2" ] , % { } )
73
61
74
62
assert { :ok , response } = result
75
- assert response [ :definition ] || response [ :error ]
63
+ assert response [ :definition ]
76
64
end
77
65
78
66
test "handles function without arity" do
79
67
result = LlmDefinition . execute ( [ "String.split" ] , % { } )
80
68
81
69
assert { :ok , response } = result
82
- assert response [ :definition ] || response [ :error ]
70
+ assert response [ :definition ]
83
71
end
84
72
85
73
test "handles function with invalid arity" do
86
74
result = LlmDefinition . execute ( [ "String.split/99" ] , % { } )
87
75
88
76
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 ]
96
78
end
97
79
98
80
test "handles special function names with ?" do
99
81
result = LlmDefinition . execute ( [ "String.valid?/1" ] , % { } )
100
82
101
83
assert { :ok , response } = result
102
- assert response [ :definition ] || response [ :error ]
84
+ assert response [ :definition ]
103
85
end
104
86
105
87
test "handles special function names with !" do
106
88
result = LlmDefinition . execute ( [ "String.upcase!/1" ] , % { } )
107
89
108
90
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 ]
116
92
end
117
93
118
94
test "handles internal errors gracefully" do
@@ -127,13 +103,6 @@ defmodule ElixirLS.LanguageServer.Providers.ExecuteCommand.LlmDefinitionTest do
127
103
end
128
104
129
105
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
-
137
106
test "handles deeply nested modules" do
138
107
result = LlmDefinition . execute ( [ "A.B.C.D.E" ] , % { } )
139
108
@@ -149,7 +118,7 @@ defmodule ElixirLS.LanguageServer.Providers.ExecuteCommand.LlmDefinitionTest do
149
118
result = LlmDefinition . execute ( [ ":erlang" ] , % { } )
150
119
151
120
assert { :ok , response } = result
152
- assert response [ :definition ] || response [ :error ]
121
+ assert response [ :definition ]
153
122
end
154
123
155
124
test "rejects invalid erlang module format" do
@@ -224,7 +193,7 @@ defmodule ElixirLS.LanguageServer.Providers.ExecuteCommand.LlmDefinitionTest do
224
193
assert { :ok , response } = result
225
194
226
195
# Should find the function even without specifying arity
227
- assert response [ :definition ] || response [ :error ]
196
+ assert response [ :definition ]
228
197
end
229
198
230
199
test "handles function with multiple arities" do
@@ -237,7 +206,7 @@ defmodule ElixirLS.LanguageServer.Providers.ExecuteCommand.LlmDefinitionTest do
237
206
assert { :ok , response } = result
238
207
239
208
# Should find one of the arities
240
- assert response [ :definition ] || response [ :error ]
209
+ assert response [ :definition ]
241
210
end
242
211
end
243
212
0 commit comments