Is there a way to have a successful test output a message?
This unit test:
test(foo1) :-
format(user_error, '>>>I am here>>>~n', []).
outputs nothing.
But these tests output the message:
test(foo2, fail) :-
format(user_error, '>>>I am here>>>~n', []).
test(foo3) :-
format(user_error, '>>>I am here>>>~n', []),
fail.
(Why am I doing this? Because - until plunit is improved (there’s a separate thread on this) - it’s useful for me to output some tracing messages from my tests to isolate which test is crashing.)
A related question: I noticed that plunit.pl has this:
Because it calls with_output_to/3 That is not picked up by the doc system yet, but is in library(streams). Before you try, this does not work for C(++) stdout output, only for Prolog I/O and foreign I/O that uses the SWI-Stream.h I/O functions.
In the other thread where I noted the GUI test runners, they show each test run and typically change color of the test to green if the test succeeds and color the test red if the test fails.
Most GUI test runners include the console output of the test run as some test cases will create a stack trace that is sent to the console instead of being captured for the test.
Another nice feature that many of the GUI test runners have is the ability to run subsets of the test, e.g. only failed test. The really nice ones will not only show failed test but by clicking on the failed test will start the build environment and then take you to the line of code in the editor.
As I noted I only used one of these GUI test runners extensively with F# so don’t know how many of these features were hard coded to work with F# and Visual Studio, not to be confused with Visual Studio Code.