I have a bunch of custom tests. In the future I may also have cram tests. I have written a dune file that looks like this:
(test
(name empty_expressions)
(libraries utest lib)
)
This file should run a single custom test. I have other tests in other directories. When I type dune runtest, I may see something like this:
% dune runtest --force
Entering directory '/srv/src/coq'
empty_expressions alias test-suite/unit-tests/coqpp/runtest (exit 1)
(cd _build/default/test-suite/unit-tests/coqpp && ./empty_expressions.exe)
Done: 789/793 (jobs: 1)%
This means that one test failed. But it is not quite readable. Compare with the output of another test suite that I have previously written in a PureScript project:
→ Suite: Invertibility
→ Suite: (Options { allNullaryToStringTag: true, sumEncoding: (TaggedObject { contentsFieldName: "contents", tagFieldName: "tag" }), tagSingleConstructors: false })
☠ Failed: SingleNullary as {} because expected (Right SingleNullary), got (Left "When decoding a SingleNullary: Expected an empty array!")
☠ Failed: (SingleUnary 1) as {} because expected (Right (SingleUnary 1)), got (Left "When decoding a SingleUnary: Value is not a Number")
☠ Failed: (SingleBinary 1 2) as {} because expected (Right (SingleBinary 1 2)), got (Left "When decoding a SingleBinary: Value is not a Number")
✓ Passed: (RecordUnary { recordUnaryField1: 1 }) as {"recordUnaryField1":1}
✓ Passed: (RecordBinary { recordBinaryField1: 1, recordBinaryField2: 2 }) as {"recordBinaryField2":2,"recordBinaryField1":1}
How can I have a similarly gorgeous report with dune based test suite? Note that dune knows the directory structure and the name of the custom test, so it has the information needed to draw the hierarchy and to call by name. It may also read the output of the program and display it as the reason of the failure.
I could make my custom tests write something beautiful to the console, but that would not extend to cram tests, would not be aware of the directory structure, would not enforce uniformity, and would not mix nicely with other dune output.
I have a bunch of custom tests. In the future I may also have cram tests. I have written a
dunefile that looks like this:This file should run a single custom test. I have other tests in other directories. When I type
dune runtest, I may see something like this:This means that one test failed. But it is not quite readable. Compare with the output of another test suite that I have previously written in a PureScript project:
How can I have a similarly gorgeous report with
dunebased test suite? Note thatduneknows the directory structure and the name of the custom test, so it has the information needed to draw the hierarchy and to call by name. It may also read the output of the program and display it as the reason of the failure.I could make my custom tests write something beautiful to the console, but that would not extend to cram tests, would not be aware of the directory structure, would not enforce uniformity, and would not mix nicely with other
duneoutput.