Skip to content

Commit

Permalink
exclude more tests on < 1.16
Browse files Browse the repository at this point in the history
  • Loading branch information
lukaszsamson committed Sep 27, 2024
1 parent ae2654b commit a235a24
Show file tree
Hide file tree
Showing 4 changed files with 92 additions and 76 deletions.
12 changes: 2 additions & 10 deletions test/elixir_sense/core/binding_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -122,19 +122,11 @@ defmodule ElixirSense.Core.BindingTest do
assert {
:struct,
[
{:__struct__, {:atom, URI}},
{:port, nil},
{:scheme, nil},
{:path, nil},
{:host, nil},
{:userinfo, nil},
{:fragment, nil},
{:query, nil},
{:authority, nil}
{:__struct__, {:atom, URI}} | _
],
{:atom, URI},
nil
} ==
} =
Binding.expand(
@env,
{
Expand Down
138 changes: 80 additions & 58 deletions test/elixir_sense/core/compiler_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -298,28 +298,34 @@ if true or Version.match?(System.version(), ">= 1.17.0-dev") do
assert_expansion("__ENV__.foo")
end

test "expands quote literal" do
assert_expansion("quote do: 2")
assert_expansion("quote do: :foo")
assert_expansion("quote do: \"asd\"")
assert_expansion("quote do: []")
assert_expansion("quote do: [12]")
assert_expansion("quote do: [12, 34]")
assert_expansion("quote do: [12 | 34]")
assert_expansion("quote do: [12 | [34]]")
assert_expansion("quote do: {12}")
assert_expansion("quote do: {12, 34}")
assert_expansion("quote do: %{a: 12}")
if Version.match?(System.version(), ">= 1.16.0") do
test "expands quote literal" do
assert_expansion("quote do: 2")
assert_expansion("quote do: :foo")
assert_expansion("quote do: \"asd\"")
assert_expansion("quote do: []")
assert_expansion("quote do: [12]")
assert_expansion("quote do: [12, 34]")
assert_expansion("quote do: [12 | 34]")
assert_expansion("quote do: [12 | [34]]")
assert_expansion("quote do: {12}")
assert_expansion("quote do: {12, 34}")
assert_expansion("quote do: %{a: 12}")
end
end

test "expands quote variable" do
assert_expansion("quote do: abc")
if Version.match?(System.version(), ">= 1.16.0") do
test "expands quote variable" do
assert_expansion("quote do: abc")
end
end

test "expands quote quote" do
assert_expansion("""
quote do: (quote do: 1)
""")
if Version.match?(System.version(), ">= 1.16.0") do
test "expands quote quote" do
assert_expansion("""
quote do: (quote do: 1)
""")
end
end

test "expands quote block" do
Expand Down Expand Up @@ -348,36 +354,44 @@ if true or Version.match?(System.version(), ">= 1.17.0-dev") do
""")
end

test "expands quote unquote_splicing" do
assert_expansion("""
a = [1, 2, 3]
quote do: (unquote_splicing(a))
""")
if Version.match?(System.version(), ">= 1.16.0") do
test "expands quote unquote_splicing" do
assert_expansion("""
a = [1, 2, 3]
quote do: (unquote_splicing(a))
""")
end
end

test "expands quote unquote_splicing in list" do
assert_expansion("""
a = [1, 2, 3]
quote do: [unquote_splicing(a) | [1]]
""")
if Version.match?(System.version(), ">= 1.16.0") do
test "expands quote unquote_splicing in list" do
assert_expansion("""
a = [1, 2, 3]
quote do: [unquote_splicing(a) | [1]]
""")

assert_expansion("""
a = [1, 2, 3]
quote do: [1 | unquote_splicing(a)]
""")
assert_expansion("""
a = [1, 2, 3]
quote do: [1 | unquote_splicing(a)]
""")
end
end

test "expands quote alias" do
assert_expansion("quote do: Date")
assert_expansion("quote do: Elixir.Date")
assert_expansion("quote do: String.Chars")
assert_expansion("alias String.Chars; quote do: Chars")
assert_expansion("alias String.Chars; quote do: Chars.foo().A")
if Version.match?(System.version(), ">= 1.16.0") do
test "expands quote alias" do
assert_expansion("quote do: Date")
assert_expansion("quote do: Elixir.Date")
assert_expansion("quote do: String.Chars")
assert_expansion("alias String.Chars; quote do: Chars")
assert_expansion("alias String.Chars; quote do: Chars.foo().A")
end
end

test "expands quote import" do
assert_expansion("quote do: inspect(1)")
assert_expansion("quote do: &inspect/1")
if Version.match?(System.version(), ">= 1.16.0") do
test "expands quote import" do
assert_expansion("quote do: inspect(1)")
assert_expansion("quote do: &inspect/1")
end
end

if Version.match?(System.version(), ">= 1.17.0") do
Expand All @@ -393,12 +407,14 @@ if true or Version.match?(System.version(), ">= 1.17.0-dev") do
end
end

test "expands quote with unquote false" do
assert_expansion("""
quote unquote: false do
unquote("hello")
if Version.match?(System.version(), ">= 1.16.0") do
test "expands quote with unquote false" do
assert_expansion("""
quote unquote: false do
unquote("hello")
end
""")
end
""")
end

if Version.match?(System.version(), ">= 1.17.0") do
Expand All @@ -409,22 +425,28 @@ if true or Version.match?(System.version(), ">= 1.17.0-dev") do
end
end

test "expands quote with line" do
assert_expansion("""
quote line: 123, do: bar(1, 2, 3)
""")
if Version.match?(System.version(), ">= 1.16.0") do
test "expands quote with line" do
assert_expansion("""
quote line: 123, do: bar(1, 2, 3)
""")
end
end

test "expands quote with location: keep" do
assert_expansion("""
quote location: :keep, do: bar(1, 2, 3)
""")
if Version.match?(System.version(), ">= 1.16.0") do
test "expands quote with location: keep" do
assert_expansion("""
quote location: :keep, do: bar(1, 2, 3)
""")
end
end

test "expands quote with context" do
assert_expansion("""
quote context: Foo, do: abc = 3
""")
if Version.match?(System.version(), ">= 1.16.0") do
test "expands quote with context" do
assert_expansion("""
quote context: Foo, do: abc = 3
""")
end
end

test "expands &super" do

Check failure on line 452 in test/elixir_sense/core/compiler_test.exs

View workflow job for this annotation

GitHub Actions / mix test (Elixir 1.14.x | Erlang/OTP 24.x)

test special forms expands &super (ElixirSense.Core.CompilerTest)

Check failure on line 452 in test/elixir_sense/core/compiler_test.exs

View workflow job for this annotation

GitHub Actions / mix test (Elixir 1.14.x | Erlang/OTP 26.x)

test special forms expands &super (ElixirSense.Core.CompilerTest)

Check failure on line 452 in test/elixir_sense/core/compiler_test.exs

View workflow job for this annotation

GitHub Actions / mix test (Elixir 1.13.x | Erlang/OTP 25.x)

test special forms expands &super (ElixirSense.Core.CompilerTest)

Check failure on line 452 in test/elixir_sense/core/compiler_test.exs

View workflow job for this annotation

GitHub Actions / mix test (Elixir 1.14.x | Erlang/OTP 23.x)

test special forms expands &super (ElixirSense.Core.CompilerTest)

Check failure on line 452 in test/elixir_sense/core/compiler_test.exs

View workflow job for this annotation

GitHub Actions / mix test windows (Elixir 1.13.x | Erlang/OTP 25.x)

test special forms expands &super (ElixirSense.Core.CompilerTest)

Check failure on line 452 in test/elixir_sense/core/compiler_test.exs

View workflow job for this annotation

GitHub Actions / mix test windows (Elixir 1.13.x | Erlang/OTP 23.x)

test special forms expands &super (ElixirSense.Core.CompilerTest)

Check failure on line 452 in test/elixir_sense/core/compiler_test.exs

View workflow job for this annotation

GitHub Actions / mix test windows (Elixir 1.14.x | Erlang/OTP 24.x)

test special forms expands &super (ElixirSense.Core.CompilerTest)

Check failure on line 452 in test/elixir_sense/core/compiler_test.exs

View workflow job for this annotation

GitHub Actions / mix test windows (Elixir 1.14.x | Erlang/OTP 25.x)

test special forms expands &super (ElixirSense.Core.CompilerTest)

Check failure on line 452 in test/elixir_sense/core/compiler_test.exs

View workflow job for this annotation

GitHub Actions / mix test windows (Elixir 1.13.x | Erlang/OTP 24.x)

test special forms expands &super (ElixirSense.Core.CompilerTest)

Check failure on line 452 in test/elixir_sense/core/compiler_test.exs

View workflow job for this annotation

GitHub Actions / mix test windows (Elixir 1.14.x | Erlang/OTP 26.x)

test special forms expands &super (ElixirSense.Core.CompilerTest)

Check failure on line 452 in test/elixir_sense/core/compiler_test.exs

View workflow job for this annotation

GitHub Actions / mix test windows (Elixir 1.14.x | Erlang/OTP 23.x)

test special forms expands &super (ElixirSense.Core.CompilerTest)
Expand Down
16 changes: 9 additions & 7 deletions test/elixir_sense/core/metadata_builder/error_recovery_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -2141,14 +2141,16 @@ defmodule ElixirSense.Core.MetadataBuilder.ErrorRecoveryTest do
assert env.typespec == {:foo, 0}
end

test "in type after :: type with fun ( nex arg" do
code = """
defmodule Abc do
@type foo :: (bar, \
"""
if Version.match?(System.version(), ">= 1.16.0") do
test "in type after :: type with fun ( nex arg" do

Check failure on line 2145 in test/elixir_sense/core/metadata_builder/error_recovery_test.exs

View workflow job for this annotation

GitHub Actions / mix test (Elixir 1.16.x | Erlang/OTP 25.x)

test typespec in type after :: type with fun ( nex arg (ElixirSense.Core.MetadataBuilder.ErrorRecoveryTest)

Check failure on line 2145 in test/elixir_sense/core/metadata_builder/error_recovery_test.exs

View workflow job for this annotation

GitHub Actions / mix test (Elixir 1.16.x | Erlang/OTP 26.x)

test typespec in type after :: type with fun ( nex arg (ElixirSense.Core.MetadataBuilder.ErrorRecoveryTest)

Check failure on line 2145 in test/elixir_sense/core/metadata_builder/error_recovery_test.exs

View workflow job for this annotation

GitHub Actions / mix test (Elixir 1.16.x | Erlang/OTP 24.x)

test typespec in type after :: type with fun ( nex arg (ElixirSense.Core.MetadataBuilder.ErrorRecoveryTest)

Check failure on line 2145 in test/elixir_sense/core/metadata_builder/error_recovery_test.exs

View workflow job for this annotation

GitHub Actions / mix test windows (Elixir 1.16.x | Erlang/OTP 25.x)

test typespec in type after :: type with fun ( nex arg (ElixirSense.Core.MetadataBuilder.ErrorRecoveryTest)

Check failure on line 2145 in test/elixir_sense/core/metadata_builder/error_recovery_test.exs

View workflow job for this annotation

GitHub Actions / mix test windows (Elixir 1.16.x | Erlang/OTP 26.x)

test typespec in type after :: type with fun ( nex arg (ElixirSense.Core.MetadataBuilder.ErrorRecoveryTest)

Check failure on line 2145 in test/elixir_sense/core/metadata_builder/error_recovery_test.exs

View workflow job for this annotation

GitHub Actions / mix test windows (Elixir 1.16.x | Erlang/OTP 24.x)

test typespec in type after :: type with fun ( nex arg (ElixirSense.Core.MetadataBuilder.ErrorRecoveryTest)
code = """
defmodule Abc do
@type foo :: (bar, \
"""

assert {_, env} = get_cursor_env(code)
assert env.typespec == {:foo, 0}
assert {_, env} = get_cursor_env(code)
assert env.typespec == {:foo, 0}
end
end

test "in type after :: type with map empty" do
Expand Down
2 changes: 1 addition & 1 deletion test/elixir_sense/core/metadata_builder_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -8037,7 +8037,7 @@ defmodule ElixirSense.Core.MetadataBuilderTest do
doc: "",
meta: %{hidden: true}
}
} == state.types
} = state.types
end

test "registers incomplete types" do
Expand Down

0 comments on commit a235a24

Please sign in to comment.