I’m not sure if this’ll fix the issue, but I believe you’re supposed to indent 4 spaces for doc tests. This has to do with markdown formatting, where it’s not seen as a code block unless it is indented or has code fences (three backticks).
So:
@doc """
Function 'subtract' takes 2 args and returns answer.
## Example
iex> MyProject.subtract(10, 5) == 5
true
"""
def subtract(a, b) do
a - b
end
I don’t think doctests care about the format. I think they just look for a line starting with iex> and then take every line after that not separated by a space and assume it’s code. Only the docs would care about the format.