Skip to content

Provide better diagnostics output #4

@evnu

Description

@evnu

Failed test cases are currently (as of d79a879) reported in the usual stack-tracy way:

./doctest -pa ebin -pa apps/examples/ebin -source apps/examples/src/failing.erl
escript: exception error: no match of right hand side value no_fail
  in function  doctest_2:run/0 (, line 4)
  in call from doctest:'-run/1-lc$^0/1-0-'/1 (src/doctest.erl, line 33)
  in call from doctest:'-main/1-lc$^0/1-0-'/1 (src/doctest.erl, line 20)
  in call from escript:run/2 (escript.erl, line 757)
  in call from escript:start/1 (escript.erl, line 277)
  in call from init:start_em/1 
  in call from init:do_boot/3

When running doctest against multiple files, the output does not indicate which test actually failed:

./doctest -pa ebin -pa apps/examples/ebin -source apps/examples/src/ex1.erl apps/examples/src/failing_edgecase.erl apps/examples/src/failing.erl 
No problems with side effects
escript: exception error: no match of right hand side value no_fail
  in function  doctest_18:run/0 (, line 4)
  in call from doctest:'-run/1-lc$^0/1-0-'/1 (src/doctest.erl, line 33)
  in call from doctest:'-main/1-lc$^0/1-0-'/1 (src/doctest.erl, line 20)
  in call from doctest:'-main/1-lc$^0/1-0-'/1 (src/doctest.erl, line 20)
  in call from escript:run/2 (escript.erl, line 757)
  in call from escript:start/1 (escript.erl, line 277)
  in call from init:start_em/1 
  in call from init:do_boot/3

A better output would be something like this:

[success] apps/examples/src/ex1.er
[success] apps/examples/src/failing_edgecase.erl
[failed] apps/examples/src/failing.erl
escript: exception error: no match of right hand side value no_fail
  in function  doctest_18:run/0 (, line 4)

The stacktrace should be cropped to the important part (the actual test), and each file should be mentioned specifically.

Metadata

Metadata

Assignees

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions