Skip to content

Commit

Permalink
exclude more tests
Browse files Browse the repository at this point in the history
  • Loading branch information
lukaszsamson committed Sep 27, 2024
1 parent fa78f3a commit 20003df
Show file tree
Hide file tree
Showing 3 changed files with 59 additions and 45 deletions.
6 changes: 2 additions & 4 deletions test/elixir_sense/core/binding_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -165,13 +165,11 @@ defmodule ElixirSense.Core.BindingTest do
assert {
:struct,
[
{:__struct__, {:atom, ArgumentError}},
{:message, nil},
{:__exception__, {:atom, true}}
{:__struct__, {:atom, ArgumentError}} | _
],
{:atom, ArgumentError},
nil
} ==
} =
Binding.expand(
@env,
{
Expand Down
92 changes: 52 additions & 40 deletions test/elixir_sense/core/metadata_builder/error_recovery_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -113,20 +113,24 @@ defmodule ElixirSense.Core.MetadataBuilder.ErrorRecoveryTest do
assert Enum.any?(env.vars, &(&1.name == :x))
end

test "invalid number of args with when" do
code = """
case nil do 0, z when not is_nil(z) -> \
"""
if Version.match?(System.version(), "< 1.14.0") do
test "invalid number of args with when" do
code = """
case nil do 0, z when not is_nil(z) -> \
"""

assert get_cursor_env(code)
assert get_cursor_env(code)
end
end

test "invalid number of args" do
code = """
case nil do 0, z -> \
"""
if Version.match?(System.version(), "< 1.14.0") do
test "invalid number of args" do
code = """
case nil do 0, z -> \
"""

assert get_cursor_env(code)
assert get_cursor_env(code)
end
end
end

Expand Down Expand Up @@ -193,12 +197,14 @@ defmodule ElixirSense.Core.MetadataBuilder.ErrorRecoveryTest do
assert Enum.any?(env.vars, &(&1.name == :x))
end

test "invalid number of args" do
code = """
cond do 0, z -> \
"""
if Version.match?(System.version(), "< 1.14.0") do
test "invalid number of args" do
code = """
cond do 0, z -> \
"""

assert get_cursor_env(code)
assert get_cursor_env(code)
end
end
end

Expand Down Expand Up @@ -310,15 +316,17 @@ defmodule ElixirSense.Core.MetadataBuilder.ErrorRecoveryTest do
assert Enum.any?(env.vars, &(&1.name == :x))
end

test "invalid number of args in after" do
code = """
receive do
a -> :ok
after
0, z -> \
"""
if Version.match?(System.version(), ">= 1.15.0") do
test "invalid number of args in after" do
code = """
receive do
a -> :ok
after
0, z -> \
"""

assert get_cursor_env(code)
assert get_cursor_env(code)
end
end

test "invalid number of clauses in after" do
Expand Down Expand Up @@ -481,16 +489,18 @@ defmodule ElixirSense.Core.MetadataBuilder.ErrorRecoveryTest do
assert Enum.any?(env.vars, &(&1.name == :x))
end

test "cursor in right side of catch clause 2 arg" do
code = """
try do
bar()
catch
x, _ -> \
"""
if Version.match?(System.version(), "< 1.14.0") do
test "cursor in right side of catch clause 2 arg" do
code = """
try do
bar()
catch
x, _ -> \
"""

assert {meta, env} = get_cursor_env(code)
assert Enum.any?(env.vars, &(&1.name == :x))
assert {meta, env} = get_cursor_env(code)
assert Enum.any?(env.vars, &(&1.name == :x))
end
end

test "cursor in left side of else clause" do
Expand Down Expand Up @@ -806,15 +816,17 @@ defmodule ElixirSense.Core.MetadataBuilder.ErrorRecoveryTest do
assert Enum.any?(env.vars, &(&1.name == :y))
end

test "cursor in do block reduce right side of clause too many args" do
code = """
for x <- [], reduce: %{} do
y, z -> \
"""
if Version.match?(System.version(), "< 1.14.0") do
test "cursor in do block reduce right side of clause too many args" do
code = """
for x <- [], reduce: %{} do
y, z -> \
"""

assert {meta, env} = get_cursor_env(code)
assert Enum.any?(env.vars, &(&1.name == :x))
assert Enum.any?(env.vars, &(&1.name == :y))
assert {meta, env} = get_cursor_env(code)
assert Enum.any?(env.vars, &(&1.name == :x))
assert Enum.any?(env.vars, &(&1.name == :y))
end
end

test "cursor in do block reduce right side of clause too little args" do
Expand Down
6 changes: 5 additions & 1 deletion test/elixir_sense/core/metadata_builder_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -8103,9 +8103,13 @@ defmodule ElixirSense.Core.MetadataBuilderTest do
kind: :type,
name: :t,
specs: ["@type t() :: term()"],
doc: "All the types that implement this protocol" <> _
doc: doc
}
} = state.types

if Version.match?(System.version(), ">= 1.14.0") do
assert "All the types that implement this protocol" <> _ = doc
end
end

test "specs and callbacks" do
Expand Down

0 comments on commit 20003df

Please sign in to comment.