Define tests within module to test private functions.
If available in Hex, the package can be installed
by adding ex_unit_embedded
to your list of dependencies in mix.exs
:
def deps do
[
{:ex_unit_embedded, "~> 0.1.0"}
]
end
Documentation can be generated with ExDoc and published on HexDocs. Once published, the docs can be found at https://hexdocs.pm/exunit_embedded.
Simply use ExUnitEmbedded
and define your tests (no describe
available):
defmodule Foo do
use ExUnitEmbedded
defp foo, do: :ok
test "foo/0 returns :ok" do
assert :ok = foo()
end
end
Then in your test module invoke unittest Foo
:
defmodule FooTest do
use ExUnit.Case
import ExUnitEmbedded
unittest Foo
end
Apache 2.0, see LICENSE.