williamthome / doctest

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

Provide a better format error info #20

Closed williamthome closed 6 months ago

williamthome commented 6 months ago

An example of a moduledoc error when the line sequence is wrong:

=ERROR REPORT==== 22-May-2024::23:27:42.877355 ===
Error in process <0.320.0> with exit value:
{{doctest,{moduledoc_format,#{line => 24,module => foo,
                              expected => <<"2> foo:foo()">>,
                              received => <<"3> foo:foo()">>}}},
 [{doctest_eunit,moduledoc_tests,
                 [foo,17,
                  [{<<"1> foo:foo()\n.. =:= bar.\nfalse\n3> foo:foo()\n.. =:=\n.. foo.\ntrue">>,
                    {4,1}}]],
                 [{file,"/home/williamthome/Projects/williamthome/doctest/src/doctest_eunit.erl"},
                  {line,70}]},
  {doctest_parse,module_tests,3,
                 [{file,"/home/williamthome/Projects/williamthome/doctest/src/doctest_parse.erl"},
                  {line,36}]},
  {doctest,module,2,
           [{file,"/home/williamthome/Projects/williamthome/doctest/src/doctest.erl"},
            {line,51}]},
  {doctest_test,module_test,0,
                [{file,"/home/williamthome/Projects/williamthome/doctest/test/doctest_test.erl"},
                 {line,21}]},
  {eunit_test,'-mf_wrapper/2-fun-0-',2,[{file,"eunit_test.erl"},{line,274}]},
  {eunit_test,run_testfun,1,[{file,"eunit_test.erl"},{line,72}]},
  {eunit_proc,run_test,1,[{file,"eunit_proc.erl"},{line,544}]},
  {eunit_proc,with_timeout,3,[{file,"eunit_proc.erl"},{line,369}]}]}