@@ -273,40 +273,36 @@ defmodule ElixirLS.Utils.CompletionEngineTest do
273
273
] = expand ( ~c" String.Cha" )
274
274
end
275
275
276
- if Version . match? ( System . version ( ) , ">= 1.14.0" ) do
277
- test "elixir submodule completion with __MODULE__" do
278
- assert [
279
- % {
280
- name: "Chars" ,
281
- full_name: "String.Chars" ,
282
- subtype: :protocol ,
283
- summary:
284
- "The `String.Chars` protocol is responsible for\n converting a structure to a binary (only if applicable)."
285
- }
286
- ] = expand ( ~c" __MODULE__.Cha" , % Env { module: String } )
287
- end
276
+ test "elixir submodule completion with __MODULE__" do
277
+ assert [
278
+ % {
279
+ name: "Chars" ,
280
+ full_name: "String.Chars" ,
281
+ subtype: :protocol ,
282
+ summary:
283
+ "The `String.Chars` protocol is responsible for\n converting a structure to a binary (only if applicable)."
284
+ }
285
+ ] = expand ( ~c" __MODULE__.Cha" , % Env { module: String } )
288
286
end
289
287
290
- if Version . match? ( System . version ( ) , ">= 1.14.0" ) do
291
- test "elixir submodule completion with attribute bound to module" do
292
- assert [
293
- % {
294
- name: "Chars" ,
295
- full_name: "String.Chars" ,
296
- subtype: :protocol ,
297
- summary:
298
- "The `String.Chars` protocol is responsible for\n converting a structure to a binary (only if applicable)."
299
- }
300
- ] =
301
- expand ( ~c" @my_attr.Cha" , % Env {
302
- attributes: [
303
- % AttributeInfo {
304
- name: :my_attr ,
305
- type: { :atom , String }
306
- }
307
- ]
308
- } )
309
- end
288
+ test "elixir submodule completion with attribute bound to module" do
289
+ assert [
290
+ % {
291
+ name: "Chars" ,
292
+ full_name: "String.Chars" ,
293
+ subtype: :protocol ,
294
+ summary:
295
+ "The `String.Chars` protocol is responsible for\n converting a structure to a binary (only if applicable)."
296
+ }
297
+ ] =
298
+ expand ( ~c" @my_attr.Cha" , % Env {
299
+ attributes: [
300
+ % AttributeInfo {
301
+ name: :my_attr ,
302
+ type: { :atom , String }
303
+ }
304
+ ]
305
+ } )
310
306
end
311
307
312
308
test "find elixir modules that require alias" do
@@ -367,32 +363,26 @@ defmodule ElixirLS.Utils.CompletionEngineTest do
367
363
assert [ % { name: "fun2ms" , origin: ":ets" } ] = expand ( ~c" :ets.fun2" )
368
364
end
369
365
370
- if Version . match? ( System . version ( ) , ">= 1.14.0" ) do
371
- test "function completion on __MODULE__" do
372
- assert [ % { name: "version" , origin: "System" } ] =
373
- expand ( ~c" __MODULE__.ve" , % Env { module: System } )
374
- end
366
+ test "function completion on __MODULE__" do
367
+ assert [ % { name: "version" , origin: "System" } ] =
368
+ expand ( ~c" __MODULE__.ve" , % Env { module: System } )
375
369
end
376
370
377
- if Version . match? ( System . version ( ) , ">= 1.14.0" ) do
378
- test "function completion on __MODULE__ submodules" do
379
- assert [ % { name: "to_string" , origin: "String.Chars" } ] =
380
- expand ( ~c" __MODULE__.Chars.to" , % Env { module: String } )
381
- end
371
+ test "function completion on __MODULE__ submodules" do
372
+ assert [ % { name: "to_string" , origin: "String.Chars" } ] =
373
+ expand ( ~c" __MODULE__.Chars.to" , % Env { module: String } )
382
374
end
383
375
384
- if Version . match? ( System . version ( ) , ">= 1.14.0" ) do
385
- test "function completion on attribute bound to module" do
386
- assert [ % { name: "version" , origin: "System" } ] =
387
- expand ( ~c" @my_attr.ve" , % Env {
388
- attributes: [
389
- % AttributeInfo {
390
- name: :my_attr ,
391
- type: { :atom , System }
392
- }
393
- ]
394
- } )
395
- end
376
+ test "function completion on attribute bound to module" do
377
+ assert [ % { name: "version" , origin: "System" } ] =
378
+ expand ( ~c" @my_attr.ve" , % Env {
379
+ attributes: [
380
+ % AttributeInfo {
381
+ name: :my_attr ,
382
+ type: { :atom , System }
383
+ }
384
+ ]
385
+ } )
396
386
end
397
387
398
388
test "function completion with arity" do
@@ -1588,37 +1578,33 @@ defmodule ElixirLS.Utils.CompletionEngineTest do
1588
1578
assert Enum . any? ( entries , & ( & 1 . name == "MyDate" and & 1 . subtype == :struct ) )
1589
1579
end
1590
1580
1591
- if Version . match? ( System . version ( ) , ">= 1.14.0" ) do
1592
- test "completion for struct names with __MODULE__" do
1593
- assert [ % { name: "__MODULE__" } ] = expand ( ~c" %__MODU" , % Env { module: Date.Range } )
1594
- assert [ % { name: "Range" } ] = expand ( ~c" %__MODULE__.Ra" , % Env { module: Date } )
1595
- end
1581
+ test "completion for struct names with __MODULE__" do
1582
+ assert [ % { name: "__MODULE__" } ] = expand ( ~c" %__MODU" , % Env { module: Date.Range } )
1583
+ assert [ % { name: "Range" } ] = expand ( ~c" %__MODULE__.Ra" , % Env { module: Date } )
1596
1584
end
1597
1585
1598
- if Version . match? ( System . version ( ) , ">= 1.14.0" ) do
1599
- test "completion for struct attributes" do
1600
- assert [ % { name: "@my_attr" } ] =
1601
- expand ( ~c" %@my" , % Env {
1602
- attributes: [
1603
- % AttributeInfo {
1604
- name: :my_attr ,
1605
- type: { :atom , Date }
1606
- }
1607
- ] ,
1608
- module: MyMod
1609
- } )
1610
-
1611
- assert [ % { name: "Range" } ] =
1612
- expand ( ~c" %@my_attr.R" , % Env {
1613
- attributes: [
1614
- % AttributeInfo {
1615
- name: :my_attr ,
1616
- type: { :atom , Date }
1617
- }
1618
- ] ,
1619
- module: MyMod
1620
- } )
1621
- end
1586
+ test "completion for struct attributes" do
1587
+ assert [ % { name: "@my_attr" } ] =
1588
+ expand ( ~c" %@my" , % Env {
1589
+ attributes: [
1590
+ % AttributeInfo {
1591
+ name: :my_attr ,
1592
+ type: { :atom , Date }
1593
+ }
1594
+ ] ,
1595
+ module: MyMod
1596
+ } )
1597
+
1598
+ assert [ % { name: "Range" } ] =
1599
+ expand ( ~c" %@my_attr.R" , % Env {
1600
+ attributes: [
1601
+ % AttributeInfo {
1602
+ name: :my_attr ,
1603
+ type: { :atom , Date }
1604
+ }
1605
+ ] ,
1606
+ module: MyMod
1607
+ } )
1622
1608
end
1623
1609
1624
1610
# handled elsewhere
@@ -2253,45 +2239,43 @@ defmodule ElixirLS.Utils.CompletionEngineTest do
2253
2239
expand ( ~c" inf" , % Env { requires: [ ] , module: MyModule , function: { :foo , 1 } } , metadata )
2254
2240
end
2255
2241
2256
- if Version . match? ( System . version ( ) , ">= 1.14.0" ) do
2257
- test "Application.compile_env classified as macro" do
2258
- assert [
2259
- % {
2260
- name: "compile_env" ,
2261
- arity: 2 ,
2262
- type: :macro ,
2263
- origin: "Application" ,
2264
- needed_require: "Application"
2265
- } ,
2266
- % {
2267
- name: "compile_env" ,
2268
- arity: 3 ,
2269
- type: :macro ,
2270
- origin: "Application" ,
2271
- needed_require: "Application"
2272
- } ,
2273
- % {
2274
- name: "compile_env" ,
2275
- arity: 4 ,
2276
- type: :function ,
2277
- origin: "Application" ,
2278
- needed_require: nil
2279
- } ,
2280
- % {
2281
- name: "compile_env!" ,
2282
- arity: 2 ,
2283
- type: :macro ,
2284
- origin: "Application" ,
2285
- needed_require: "Application"
2286
- } ,
2287
- % {
2288
- name: "compile_env!" ,
2289
- arity: 3 ,
2290
- type: :function ,
2291
- origin: "Application" ,
2292
- needed_require: nil
2293
- }
2294
- ] = expand ( ~c" Application.compile_e" )
2295
- end
2242
+ test "Application.compile_env classified as macro" do
2243
+ assert [
2244
+ % {
2245
+ name: "compile_env" ,
2246
+ arity: 2 ,
2247
+ type: :macro ,
2248
+ origin: "Application" ,
2249
+ needed_require: "Application"
2250
+ } ,
2251
+ % {
2252
+ name: "compile_env" ,
2253
+ arity: 3 ,
2254
+ type: :macro ,
2255
+ origin: "Application" ,
2256
+ needed_require: "Application"
2257
+ } ,
2258
+ % {
2259
+ name: "compile_env" ,
2260
+ arity: 4 ,
2261
+ type: :function ,
2262
+ origin: "Application" ,
2263
+ needed_require: nil
2264
+ } ,
2265
+ % {
2266
+ name: "compile_env!" ,
2267
+ arity: 2 ,
2268
+ type: :macro ,
2269
+ origin: "Application" ,
2270
+ needed_require: "Application"
2271
+ } ,
2272
+ % {
2273
+ name: "compile_env!" ,
2274
+ arity: 3 ,
2275
+ type: :function ,
2276
+ origin: "Application" ,
2277
+ needed_require: nil
2278
+ }
2279
+ ] = expand ( ~c" Application.compile_e" )
2296
2280
end
2297
2281
end
0 commit comments