williamthome / doctest

A library to test Erlang documentation
https://hex.pm/packages/doctest
Apache License 2.0
8 stars 1 forks source link

Ability to skip the right side of the match #44

Open williamthome opened 3 months ago

williamthome commented 3 months ago

Take this example from Euneus:

1> begin
.. {continue, State} = euneus_decoder:stream_start(<<"{\"foo\":">>, #{}),
.. euneus_decoder:stream_continue(<<"1}">>, State)
.. end.
{end_of_input,#{<<"foo">> => 1}}

There is unwanted noise in this code block by using begin...end.

Doctest should be able to skip the match (right value), for example:

1> {continue, State} = euneus_decoder:stream_start(<<"{\"foo\":">>, #{}).
2> euneus_decoder:stream_continue(<<"1}">>, State).
{end_of_input,#{<<"foo">> => 1}}

The State is an opaque term and contains irrelevant information. It's not necessary to print it in the example.