From a00e8f02b7eb3f1ddc45c08a88acb273e880eb80 Mon Sep 17 00:00:00 2001 From: Lukasz Samson Date: Mon, 7 Aug 2023 10:05:15 +0200 Subject: [PATCH] fix tests on OTP 22 --- test/elixir_sense/docs_test.exs | 26 +++++++++++----------- test/elixir_sense/signature_test.exs | 24 +++++++++++---------- test/elixir_sense/suggestions_test.exs | 30 ++++++++++++++------------ 3 files changed, 43 insertions(+), 37 deletions(-) diff --git a/test/elixir_sense/docs_test.exs b/test/elixir_sense/docs_test.exs index ab77c201..b7df1d05 100644 --- a/test/elixir_sense/docs_test.exs +++ b/test/elixir_sense/docs_test.exs @@ -370,22 +370,24 @@ defmodule ElixirSense.DocsTest do assert actual_subject == "MyLocalModule.init" - assert docs =~ """ - > MyLocalModule.init(list) + if ExUnitConfig.erlang_eep48_supported() do + assert docs =~ """ + > MyLocalModule.init(list) - **Implementing behaviour** - :gen_statem - **Since** - OTP 19.0 + **Implementing behaviour** + :gen_statem + **Since** + OTP 19.0 - ### Specs + ### Specs - ``` - @callback init(args :: term) ::\ - """ + ``` + @callback init(args :: term) ::\ + """ - assert docs =~ - "this function is called by the new process to initialize the implementation state and server data" + assert docs =~ + "this function is called by the new process to initialize the implementation state and server data" + end end test "retrieve metadata macro documentation - fallback to macrocallback" do diff --git a/test/elixir_sense/signature_test.exs b/test/elixir_sense/signature_test.exs index 4e6f2040..b243126a 100644 --- a/test/elixir_sense/signature_test.exs +++ b/test/elixir_sense/signature_test.exs @@ -1144,17 +1144,19 @@ defmodule ElixirSense.SignatureTest do res = ElixirSense.signature(code, 12, 27) - assert %{ - active_param: 0, - signatures: [ - %{ - documentation: "- Args = term" <> _, - name: "init", - params: ["list"], - spec: "@callback init(args :: term) :: init_result(state)" - } - ] - } = res + if ExUnitConfig.erlang_eep48_supported() do + assert %{ + active_param: 0, + signatures: [ + %{ + documentation: "- Args = term" <> _, + name: "init", + params: ["list"], + spec: "@callback init(args :: term) :: init_result(state)" + } + ] + } = res + end end test "retrieve metadata macro signature - fallback to macrocallback" do diff --git a/test/elixir_sense/suggestions_test.exs b/test/elixir_sense/suggestions_test.exs index bee78f41..6a043066 100644 --- a/test/elixir_sense/suggestions_test.exs +++ b/test/elixir_sense/suggestions_test.exs @@ -1007,20 +1007,22 @@ defmodule ElixirSense.SuggestionsTest do ElixirSense.suggestions(buffer, 12, 22) |> Enum.filter(fn s -> s.type == :function end) - assert [ - %{ - args: "list", - arity: 1, - def_arity: 1, - metadata: %{implementing: :gen_statem, since: "OTP 19.0"}, - name: "init", - origin: "MyLocalModule", - spec: "@callback init(args :: term) ::" <> _, - summary: "- Args = term" <> _, - type: :function, - visibility: :public - } - ] = list + if ExUnitConfig.erlang_eep48_supported() do + assert [ + %{ + args: "list", + arity: 1, + def_arity: 1, + metadata: %{implementing: :gen_statem, since: "OTP 19.0"}, + name: "init", + origin: "MyLocalModule", + spec: "@callback init(args :: term) ::" <> _, + summary: "- Args = term" <> _, + type: :function, + visibility: :public + } + ] = list + end end test "list metadata macro - fallback to macrocallback" do