Hi there! I faced a behaviour when in
doctest we pass option
:only with the functions to test, but the module actually doesn't have those functions listed publicly - doctest just gets ignored and doesn't even report about that.
The issue is, if I rename the function but forget to update its docs and doctest - the whole will not point that out but rather just pass with less tests. And leaves me with outdated and non tested docs.
The small example:
defmodule DoctestOnly do
@doc """
Hello world.
## Examples
iex> DoctestOnly.hello()
:world
"""
def foo do
:world
end end
and the test
defmodule DoctestOnlyTest do
use ExUnit.Case
doctest DoctestOnly, only: [hello: 0]
end
I would expect test to crash with some message like "function DoctestOnly.hello/0 is undefined or private"
I put up together a commit that somewhat solves the issue for me. Not sure if it's desirable, though: