alisinabh

alisinabh

Ex_docs some examples not showing

Hi

I’ve recently faced a problem with doc tests on html documents:

Here is my code and docs:

@doc """
Does something good!

## Examples
iex> Module.do_something
{:ok, 123}

iex> Module.do_something
:error
"""
def do_something() do
  ...
end

In the documents the output will be like:

Examples

iex> Module.do_something
iex> Module.do_something :error

As you can see the tuple in the first example is missing in the docs. Am i doing something wrong?

Marked As Solved

voughtdq

voughtdq

Hi, have you put four spaces before the doc tests? It looks like you haven’t, but it might have just been caused by copy/paste.

@doc """
Articulates the given frob.

## Examples

    iex> frob = %Frob{}
    iex> Articulator.articulate(frob)
    {:ok, %Frob{articulated: true}}

"""
def articulate(%Frob{}) do
  {:ok, %Frob{articulated: true}}
end

Until I changed my doctests to what you see above, weird things happened.

Last Post!

alisinabh

alisinabh

Yes that was my problem. :slight_smile:

Thank you very much

Where Next?

Popular in Questions Top

minhajuddin
I have seen a lot of code which picks the first element from a list using Enum.at(0) instead of List.first. Is there a reason why people ...
New
baxterw3b
Hi guys, i’m new in the Elixir world, and i have to say, that i love it! i’m having some problem to understand anonymous functions with ...
New
lastday4you
I wanted to check elixir version in phoenix because i found that my elixir is 1.5 but when i use Enum.chunk_by it said the function is un...
New
Darmani72
If I have a post route which an argument: post /my_post_route/:my_param1, MyController.my_post_handler How would get the post params ...
New
joeerl
Hello again - after a longish gap I’ve decided I really must dig into Elixir and see what’s been happening here - so I have a few questio...
New
vrod
I am using the Starship cross-shell prompt – it seems pretty nice, but I get some errors: [WARN] - (starship::utils): Executing command ...
New
dblack
I’ve got an issue with an app and I’ve no idea of how to troubleshoot it. I’m hoping someone here might have seen something similar. I p...
New

Other popular topics Top

nobody
Hi! In PHP: $_SERVER[‘SERVER_ADDR’] - in Elixir? Searched the docs for ip address and the web, no good results. Thanks!
New
JeremM34
Hello, how can I check the Phoenix version ? Thanks !
New
vertexbuffer
Hello, can anybody help here..? I have a list of players and I what to delete an element, but every for loop the list is reverting to ori...
New
grych
Hi folks, Few months ago I have announced the proof-of-concept of the library to manipulate the browsers DOM objects directly from Elixi...
639 54260 488
New
dokuzbir
I want to highlight html closing tags when i click a html tag. That works in .html files but doesnt work for html.eex templates. How can...
New
AstonJ
Posting this to see if we can make things easier for people to get into Neovim. If you use Neovim and have a favourite distro please let ...
New

We're in Beta

About us Mission Statement