GitHunt
HA

hauleth/ex_unit_embedded

Define ExUnit tests alongside your private functions to test them.

ExUnitEmbedded

Define tests within module to test private functions.

Installation

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.

Usage

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

License

Apache 2.0, see LICENSE.

Languages

Elixir100.0%

Contributors

Apache License 2.0
Created February 6, 2019
Updated March 12, 2026
hauleth/ex_unit_embedded | GitHunt