Skip to content

Commit

Permalink
disabled tests on versions not supported by elixir sense
Browse files Browse the repository at this point in the history
  • Loading branch information
scohen committed Jan 3, 2025
1 parent 1430df4 commit 8771ec2
Show file tree
Hide file tree
Showing 2 changed files with 58 additions and 50 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -846,8 +846,10 @@ defmodule Lexical.Server.CodeIntelligence.Completion.Translations.MacroTest do
"macro_2_without_parens ${1:arg1}, ${2:arg2}, ${3:arg3}, ${4:arg4}"
end

test "completes ExUnit macros without parens", %{project: project} do
source = ~q[
if Version.match?(System.version(), ">= 1.15.0") do
# The update to elixir sense broke these tests
test "completes ExUnit macros without parens", %{project: project} do
source = ~q[
defmodule ExampleTest do
use ExUnit.Case
Expand All @@ -857,53 +859,54 @@ defmodule Lexical.Server.CodeIntelligence.Completion.Translations.MacroTest do
end
]

assert {:ok, completion} =
project
|> complete(source)
|> fetch_completion("assert assertion")
assert {:ok, completion} =
project
|> complete(source)
|> fetch_completion("assert assertion")

assert completion.label == "assert assertion"
assert apply_completion(completion) =~ "assert ${1:assertion}"
assert completion.label == "assert assertion"
assert apply_completion(completion) =~ "assert ${1:assertion}"
end
end
end

test "test completion snippets", %{project: project} do
assert {:ok, [stub, with_body, with_context | _ignored]} =
project
|> complete(inside_exunit_context("test|"))
|> fetch_completion("test ")
test "test completion snippets", %{project: project} do

Check failure on line 872 in apps/server/test/lexical/server/code_intelligence/completion/translations/macro_test.exs

View workflow job for this annotation

GitHub Actions / Test on OTP 25 / Elixir 1.13

test normal macro completion test completion snippets (Lexical.Server.CodeIntelligence.Completion.Translations.MacroTest)

Check failure on line 872 in apps/server/test/lexical/server/code_intelligence/completion/translations/macro_test.exs

View workflow job for this annotation

GitHub Actions / Test on OTP 25 / Elixir 1.14

test normal macro completion test completion snippets (Lexical.Server.CodeIntelligence.Completion.Translations.MacroTest)
assert {:ok, [stub, with_body, with_context | _ignored]} =
project
|> complete(inside_exunit_context("test|"))
|> fetch_completion("test ")

assert ~S(test "message" ) = stub.label
assert "A stub test" = stub.detail
assert :snippet = stub.insert_text_format
assert apply_completion(stub) == inside_exunit_context("test \"${0:message}\"")
assert ~S(test "message" ) = stub.label
assert "A stub test" = stub.detail
assert :snippet = stub.insert_text_format
assert apply_completion(stub) == inside_exunit_context("test \"${0:message}\"")

assert ~S(test "message" do... ) = with_body.label
assert "A test" = with_body.detail
assert :snippet = with_body.insert_text_format
assert ~S(test "message" do... ) = with_body.label
assert "A test" = with_body.detail
assert :snippet = with_body.insert_text_format

assert apply_completion(with_body) ==
inside_exunit_context("test \"${1:message}\" do\n $0\nend")
assert apply_completion(with_body) ==
inside_exunit_context("test \"${1:message}\" do\n $0\nend")

assert ~S(test "message", %{} do...) = with_context.label
assert "A test that receives context" = with_context.detail
assert :snippet = with_context.insert_text_format
assert ~S(test "message", %{} do...) = with_context.label
assert "A test that receives context" = with_context.detail
assert :snippet = with_context.insert_text_format

assert apply_completion(with_context) ==
inside_exunit_context("test \"${1:message}\", %{${2:context}} do\n $0\nend")
end
assert apply_completion(with_context) ==
inside_exunit_context("test \"${1:message}\", %{${2:context}} do\n $0\nend")
end

test "describe blocks", %{project: project} do
assert {:ok, describe} =
project
|> complete(inside_exunit_context("descr|"))
|> fetch_completion("describe ")
test "describe blocks", %{project: project} do

Check failure on line 898 in apps/server/test/lexical/server/code_intelligence/completion/translations/macro_test.exs

View workflow job for this annotation

GitHub Actions / Test on OTP 25 / Elixir 1.13

test normal macro completion describe blocks (Lexical.Server.CodeIntelligence.Completion.Translations.MacroTest)

Check failure on line 898 in apps/server/test/lexical/server/code_intelligence/completion/translations/macro_test.exs

View workflow job for this annotation

GitHub Actions / Test on OTP 25 / Elixir 1.14

test normal macro completion describe blocks (Lexical.Server.CodeIntelligence.Completion.Translations.MacroTest)
assert {:ok, describe} =
project
|> complete(inside_exunit_context("descr|"))
|> fetch_completion("describe ")

assert describe.label == "describe \"message\""
assert describe.insert_text_format == :snippet
assert describe.label == "describe \"message\""
assert describe.insert_text_format == :snippet

assert apply_completion(describe) ==
inside_exunit_context("describe \"${1:message}\" do\n $0\nend")
assert apply_completion(describe) ==
inside_exunit_context("describe \"${1:message}\" do\n $0\nend")
end
end

describe "syntax macros" do
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,44 +87,49 @@ defmodule Lexical.Server.CodeIntelligence.Completion.Translations.StructTest do
assert apply_completion(completion) == expected
end

test "should complete module aliases after %", %{project: project} do
source = ~q[
if Version.match?(System.version(), ">= 1.15.0") do
# The elixir sense upgrade caused these tests to fail.
test "should complete module aliases after %", %{project: project} do
source = ~q[
defmodule TestModule do
alias Project.Structs.User
def my_function(%Us|)
]

expected = ~q[
expected = ~q[
defmodule TestModule do
alias Project.Structs.User
def my_function(%User{$1})
]

assert [completion] = complete(project, source)
assert [completion] = complete(project, source)

assert completion.kind == :struct
assert apply_completion(completion) == expected
end
assert completion.kind == :struct
assert apply_completion(completion) == expected
end

test "should complete, but not add curlies when last word not contains %", %{project: project} do
source = ~q[
test "should complete, but not add curlies when last word not contains %", %{
project: project
} do
source = ~q[
defmodule TestModule do
alias Project.Structs.User
Us|
]

assert [completion] = complete(project, source)
assert completion.kind == :module
assert [completion] = complete(project, source)
assert completion.kind == :module

assert apply_completion(completion) == ~q[
assert apply_completion(completion) == ~q[
defmodule TestModule do
alias Project.Structs.User
User
]
end
end

test "should complete non-aliased correctly", %{project: project} do
Expand Down

0 comments on commit 8771ec2

Please sign in to comment.