I have the following files. If you look in app.ex the doctest says 2 + 2 is 3. I am intentionally trying to make it fail.
app.ex
defmodule App do
@doc """
Adds two numbers
## Examples
iex> App.add(2, 2)
3
"""
def add(a,b) do
a + b
end
end
app_test.exs
defmodule AppTest do
use ExUnit.Case
doctest App
end
In the console I type: mix test and the result is:
Finished in 0.01 seconds
0 failures
Randomized with seed 547000
It seems that mix is not finding any test cases at all, otherwise you would get the message
12 tests, 0 failuresinstead of just0 failuresThis probably happens because of the non-standard naming of your test file. In Elixir, test files must end with
*_test.exs, you used*.text.exs(maybe a typo).If you rename your test to
test/app_test.exsit should work just fine.