Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: compile test module only on test #108

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 0 additions & 14 deletions lib/ecto_enum/typespec.ex
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,3 @@ defmodule EctoEnum.Typespec do

defp add_type(type, acc), do: {:|, [], [type, acc]}
end

defmodule EctoEnum.Typespec.TestModule do
@moduledoc """
Sample enum-containing module for testing type generation. Types aren't
generated for dynamically generated modules that eunit uses, so we have to
prepare this module in advance
"""

import EctoEnum

defenum StatusEnum, registered: 0, active: 1, inactive: 2, archived: 3

defenum PGStatusEnum, :status, [:registered, :active, :inactive, :archived]
end
6 changes: 5 additions & 1 deletion mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,17 @@ defmodule EctoEnum.Mixfile do
test_paths: test_paths(Mix.env()),
package: package(),
name: "EctoEnum",
docs: [source_ref: "v#{@version}", source_url: "https://github.com/gjaldon/ecto_enum"]
docs: [source_ref: "v#{@version}", source_url: "https://github.com/gjaldon/ecto_enum"],
elixirc_paths: elixrc_paths(Mix.env())
]
end

defp test_paths(:mysql), do: ["test/mysql"]
defp test_paths(_), do: ["test/pg"]

defp elixrc_paths(env) when env in ~w(mysql test)a, do: ["lib", "test/support"]
defp elixrc_paths(_), do: ["lib"]

defp package do
[
maintainers: ["Gabriel Jaldon"],
Expand Down
13 changes: 13 additions & 0 deletions test/support/typespec_test_module.ex
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
defmodule EctoEnum.Typespec.TestModule do
@moduledoc """
Sample enum-containing module for testing type generation. Types aren't
generated for dynamically generated modules that eunit uses, so we have to
prepare this module in advance
"""

import EctoEnum

defenum StatusEnum, registered: 0, active: 1, inactive: 2, archived: 3

defenum PGStatusEnum, :status, [:registered, :active, :inactive, :archived]
end