Skip to content

Commit

Permalink
fix tests on OTP 22
Browse files Browse the repository at this point in the history
  • Loading branch information
lukaszsamson committed Aug 7, 2023
1 parent 34809ff commit a00e8f0
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 37 deletions.
26 changes: 14 additions & 12 deletions test/elixir_sense/docs_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
24 changes: 13 additions & 11 deletions test/elixir_sense/signature_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
30 changes: 16 additions & 14 deletions test/elixir_sense/suggestions_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit a00e8f0

Please sign in to comment.