Well, after working out the regular comments a bit, I can tell you the hard 
part is implementing
the inclusion of regular comments, because they may not always make a valid 
doctest.
Result comments (#=> ) and print comments (#>> ) are super easy to implement,
literally 8 lines of code each.

But they work different, because the implementation that I made for regular 
comment only take a
regular comment as a line starting with a hash followed by a white-space, 
otherwise it is not
possible to differentiate it from "#PID<0.94.0>" or mapsets.

Result and print comments (#=>, #>>) cannot be treated as regular comments, 
because doctests will
always validate with them. And yes, they are not evaluated (that's the whole 
point of having them),
otherwise we would just use regular code.

Please have a look at the final implementation.
https://github.com/eksperimental/elixir/tree/doctest_comments
I think I have covered all the cases with invalid tests when comments are used.

This commits 
https://github.com/eksperimental/elixir/commit/d79e7aea4e07e15550c97ed67487d0b2e019ff3f
details all the changes, I can split them at least in two commits if we decide 
to go with them



On Fri, 19 May 2017 16:37:35 +0000
José Valim <jose.va...@plataformatec.com.br> wrote:

> If they fit under the first case, then sure. But no special case should be
> added and we should not promote using comments for return types. If you
> write this:
> 
>     IEx> 1
>     #=> :oops
> 
> We won't compare 1 with :oops. And there is no purpose in writing in the
> style above as nothing will be tested anyway.
> 

-- 
You received this message because you are subscribed to the Google Groups 
"elixir-lang-core" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to elixir-lang-core+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/elixir-lang-core/20170529075033.6496a6f4.eksperimental%40autistici.org.
For more options, visit https://groups.google.com/d/optout.

Reply via email to