Skip to content

Commit

Permalink
Address soft deprecation; prefer ExUnit.Case.register_test/6
Browse files Browse the repository at this point in the history
  - ExUnit.Case.register_test/6 has been available since Elixir 1.11.0,
    and now triggers deprecation warnings as of Elixir 1.17
  • Loading branch information
vanderhoop committed Jun 6, 2024
1 parent f9d3c35 commit 05247fa
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions lib/wallaby/feature.ex
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,17 @@ defmodule Wallaby.Feature do
context = Macro.escape(context)
contents = Macro.escape(contents, unquote: true)

quote bind_quoted: [context: context, contents: contents, message: message] do
name = ExUnit.Case.register_test(__ENV__, :feature, message, [:feature])
%{module: mod, file: file, line: line} = __CALLER__

quote bind_quoted: [
mod: mod,
file: file,
line: line,
context: context,
contents: contents,
message: message
] do
name = ExUnit.Case.register_test(mod, file, line, :test, message, [:feature])

def unquote(name)(unquote(context)), do: unquote(contents)
end
Expand Down

0 comments on commit 05247fa

Please sign in to comment.