Skip to content

Commit

Permalink
Refactor test helper
Browse files Browse the repository at this point in the history
  • Loading branch information
danschultzer committed Aug 16, 2023
1 parent 75ddae1 commit db2291d
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions test/dialyxir/project_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,17 @@ defmodule Dialyxir.ProjectTest do
import ExUnit.CaptureIO, only: [capture_io: 1, capture_io: 2]

defp in_project(app, f) when is_atom(app) do
Mix.Project.in_project(app, "test/fixtures/#{Atom.to_string(app)}", fn _ -> f.() end)
in_project(app, "test/fixtures/#{Atom.to_string(app)}", f)
end

defp in_project(apps, f) when is_list(apps) do
path = Enum.map_join(apps, "/", &Atom.to_string/1)
app = List.last(apps)
Mix.Project.in_project(app, "test/fixtures/#{path}", fn _ -> f.() end)
in_project(app, "test/fixtures/#{path}", f)
end

defp in_project(app, path, f) do
Mix.Project.in_project(app, path, fn _ -> f.() end)
end

test "Default Project PLT File in _build dir" do
Expand Down

0 comments on commit db2291d

Please sign in to comment.