Skip to content

Commit

Permalink
Address Elixir 1.16 compilation warnings (#139)
Browse files Browse the repository at this point in the history
  • Loading branch information
bradhanks authored Apr 10, 2024
1 parent d59654b commit 3f4aac1
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 10 deletions.
2 changes: 1 addition & 1 deletion config/config.exs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# This file is responsible for configuring your application
# and its dependencies with the aid of the Mix.Config module.
use Mix.Config
import Config

config :bypass, test_framework: :ex_unit

Expand Down
12 changes: 5 additions & 7 deletions lib/bypass/utils.ex
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,14 @@ defmodule Bypass.Utils do

Application.load(:bypass)

if Application.get_env(:bypass, :enable_debug_log, false) do
defmacro debug_log(msg) do
quote bind_quoted: [msg: msg] do
defmacro debug_log(msg) do
quote bind_quoted: [msg: msg] do
if Application.get_env(:bypass, :enable_debug_log, false) do
require Logger
Logger.debug(["[bypass] ", msg])
else
:ok
end
end
else
defmacro debug_log(_msg) do
:ok
end
end
end
4 changes: 2 additions & 2 deletions test/bypass_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -541,7 +541,7 @@ defmodule BypassTest do
end

test "Bypass.verify_expectations! - with ESpec it will check if the expectations are being met" do
Mix.Config.persist(bypass: [test_framework: :espec])
Application.put_all_env(bypass: [test_framework: :espec])

# Fail: no requests
bypass = prepare_stubs()
Expand Down Expand Up @@ -579,7 +579,7 @@ defmodule BypassTest do
Bypass.verify_expectations!(bypass)
end

Mix.Config.persist(bypass: [test_framework: :ex_unit])
Application.put_all_env(bypass: [test_framework: :ex_unit])
end

test "Bypass.open/1 raises when cannot start child" do
Expand Down

0 comments on commit 3f4aac1

Please sign in to comment.