Skip to content

Commit

Permalink
exclude more version dependant tests
Browse files Browse the repository at this point in the history
  • Loading branch information
lukaszsamson committed May 4, 2024
1 parent b7392be commit 94bda2d
Showing 1 changed file with 45 additions and 33 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -125,8 +125,10 @@ defmodule ElixirLS.LanguageServer.Providers.CodeAction.ReplaceRemoteFunctionTest
}
|> modify(suggestion: "Enum.concat")

assert result ==
"for x <- Enum.concat([[1], [2], [3]]), do: Enum.concat([[1], [2], [3], [x]])"
if Version.match?(System.version(), ">= 1.13.0") do
assert result ==
"for x <- Enum.concat([[1], [2], [3]]), do: Enum.concat([[1], [2], [3], [x]])"
end
end

test "applied in a with block" do
Expand All @@ -136,7 +138,9 @@ defmodule ElixirLS.LanguageServer.Providers.CodeAction.ReplaceRemoteFunctionTest
}
|> modify()

assert result == "with x <- Enum.count([1, 2, 3]), do: x"
if Version.match?(System.version(), ">= 1.13.0") do
assert result == "with x <- Enum.count([1, 2, 3]), do: x"
end
end

test "applied in a with block, preserves comment" do
Expand All @@ -146,7 +150,9 @@ defmodule ElixirLS.LanguageServer.Providers.CodeAction.ReplaceRemoteFunctionTest
}
|> modify()

assert result == "with x <- Enum.count([1, 2, 3]), do: x # TODO: Fix this"
if Version.match?(System.version(), ">= 1.13.0") do
assert result == "with x <- Enum.count([1, 2, 3]), do: x # TODO: Fix this"
end
end

test "applied in a with block with started do end" do
Expand All @@ -156,7 +162,9 @@ defmodule ElixirLS.LanguageServer.Providers.CodeAction.ReplaceRemoteFunctionTest
}
|> modify()

assert result == "with x <- Enum.count([1, 2, 3]) do"
if Version.match?(System.version(), ">= 1.13.0") do
assert result == "with x <- Enum.count([1, 2, 3]) do"
end
end

test "preserving the leading indent" do
Expand All @@ -165,20 +173,22 @@ defmodule ElixirLS.LanguageServer.Providers.CodeAction.ReplaceRemoteFunctionTest
assert result == " Enum.count([1, 2, 3])"
end

test "handles erlang functions" do
message = """
:ets.inserd/2 is undefined or private. Did you mean:
* insert/2
* insert_new/2
"""

{:ok, [result]} =
~q{
:ets.inserd(a, b)
}
|> modify(message: message, suggestion: ":ets.insert(a, b)")

assert result == ":ets.insert(a, b)"
if System.otp_release() |> String.to_integer() >= 23 do
test "handles erlang functions" do
message = """
:ets.inserd/2 is undefined or private. Did you mean:
* insert/2
* insert_new/2
"""

{:ok, [result]} =
~q{
:ets.inserd(a, b)
}
|> modify(message: message, suggestion: ":ets.insert(a, b)")

assert result == ":ets.insert(a, b)"
end
end

test "when aliased" do
Expand Down Expand Up @@ -293,20 +303,22 @@ defmodule ElixirLS.LanguageServer.Providers.CodeAction.ReplaceRemoteFunctionTest
assert result == " &Enum.count/1"
end

test "handles erlang functions" do
message = """
:ets.inserd/2 is undefined or private. Did you mean:
* insert/2
* insert_new/2
"""

{:ok, [result]} =
~q{
&:ets.inserd/2
}
|> modify(message: message, suggestion: ":ets.insert/2")

assert result == "&:ets.insert/2"
if System.otp_release() |> String.to_integer() >= 23 do
test "handles erlang functions" do
message = """
:ets.inserd/2 is undefined or private. Did you mean:
* insert/2
* insert_new/2
"""

{:ok, [result]} =
~q{
&:ets.inserd/2
}
|> modify(message: message, suggestion: ":ets.insert/2")

assert result == "&:ets.insert/2"
end
end

test "when aliased" do
Expand Down

0 comments on commit 94bda2d

Please sign in to comment.