Skip to content

Commit

Permalink
Fix struct test and fix warnings
Browse files Browse the repository at this point in the history
Also ensure compiler warnings happen on GA
  • Loading branch information
edgurgel committed Jun 22, 2024
1 parent f073afb commit f9d2f5b
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,15 @@ jobs:
- name: Install dependencies
run: mix deps.get

- name: Compile with --warnings-as-errors
run: mix compile --warnings-as-errors

- name: Run "mix format"
run: mix format --check-formatted

- name: Credo
run: mix credo --strict

- name: Compile with --warnings-as-errors
run: mix compile --warnings-as-errors

test:
name: Test (Elixir ${{matrix.elixir}} | Erlang/OTP ${{matrix.otp}})
runs-on: ubuntu-latest
Expand Down
6 changes: 3 additions & 3 deletions lib/mimic/server.ex
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@ defmodule Mimic.Server do
internal_functions = [__info__: 1, module_info: 0, module_info: 1]

stubs =
module.module_info[:exports]
module.module_info(:exports)
|> Enum.filter(&(&1 not in internal_functions))
|> Enum.reduce(state.stubs, fn {fn_name, arity}, stubs ->
func = stub_function(module, fn_name, arity)
Expand Down Expand Up @@ -317,12 +317,12 @@ defmodule Mimic.Server do
internal_functions = [__info__: 1, module_info: 0, module_info: 1]

mocked_public_functions =
original_module.module_info[:exports]
original_module.module_info(:exports)
|> Enum.filter(&(&1 not in internal_functions))
|> MapSet.new()

mocking_public_functions =
mocking_module.module_info[:exports]
mocking_module.module_info(:exports)
|> Enum.filter(&(&1 not in internal_functions))
|> MapSet.new()

Expand Down
2 changes: 2 additions & 0 deletions test/mimic_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -947,6 +947,8 @@ defmodule Mimic.Test do
end

describe "structs" do
setup :set_mimic_private

test "copies struct fields" do
struct_fields =
Structs.__info__(:struct)
Expand Down

0 comments on commit f9d2f5b

Please sign in to comment.