Doctest a delegated function

Hello,

I have a weird question today regarding doctest.

I have recently built an Erlang module, but use Elixir for testing.

I also have an Elixir module that basically uses defdelegate its function to the Erlang module.

I want to write doctests in Elixir module for those delegated functions (since I can’t do that in Erlang, and Elixir’s one is nice).

However, when I run mix test, I encounter the following warnings:

.....warning: GenNTTP.command/2 is undefined (module GenNTTP is not available or is yet to be defined)
  (for doctest at) lib/gen_nntp.ex:104: GenNNTPTest."doctest GenNNTP.command/3 (1)"/1

warning: GenNTTP.connect/0 is undefined (module GenNTTP is not available or is yet to be defined)
  (for doctest at) lib/gen_nntp.ex:103: GenNNTPTest."doctest GenNNTP.command/3 (1)"/1

Here is the small snippet for the Elixir module:

defmodule GenNNTP do

  @doc """
  Sends a command and receives server's response.

  Both single and multi-line response are handled.

  For commands that are followed by a multi-line data block, such as
  "POST", place the block as the argument to `command/3` call.

  ## Examples

      iex> {:ok, socket, _greeting} = GenNTTP.connect()
      iex> GenNTTP.command(socket, "HELP")
      :ok
  """
  defdelegate command(socket, command, args \\ []), to: :gen_nntp

end

Is this expected? What can I do to overcome that?

Ah, please disregard. I have a typo in my module name :confused:

3 Likes

Rubber duck debugging strikes again! :heart:

1 Like

Haha, silly me. I should have talked to the rubber duck in front of me.