Not all EUnit states are managed in ltest listener
oubiwann opened this issue · 5 comments
Sadly, EUnit states are undocumented. The source code has to be examined when attempting to create a 100% EUnit compatible test listener.
The following files need to be compared carefully:
- https://github.com/erlang/otp/blob/maint/lib/eunit/src/eunit_listener.erl
- https://github.com/lfex/ltest/blob/master/src/ltest-listener.lfe
With the latter getting updates for the missing (or commented-out) bits. Note that this set of missing functionality dates from the earlier days of ltest (formerly lunit, formerly lfeunit).
Tasks:
- Handle cancelled tests
- Add
start/2
(not really state management, but we can hit this while we're bringing the rest ofltest_listener
into accord witheunit_listener
) - In
handle_begin
add another clause like for theundefined
description, but for an empty string - In
handle_end
add another clause like for theundefined
description, but for an empty string
Note that there are some breaking changes between 17.x and 18.x.
Could you rewrite it so that ltest-listener
calls eunit_listener
? If that works then you might become more future safe. I managed to do that for the QLC handling.
@rvirding Do you have some code I can look at? (I didn't see anything like this in lfe_qlc.erl
). It's not immediately obvious to me how to do that, since it's eunit_listener.erl
s callbacks I need to override ... (eunit_listener
is a behaviour that I'm implementing against). When I first wrote this (a few years ago), the start
function was the only one I could call back to cleanly :-/
Maybe there's a different way to do this?
@oubiwann do you mean to compare with eunit_tty.erl ? That is the file that implements the behaviour. eunit_listener
is the module that defines the behaviour.
Maybe this is what made rvirding think you could just reuse eunit_listener
.
@oubiwann the new lfe_qlc.erl
in the develop branch now does some cunning calls into the standard qlc modules instead of copying the module so it could add some new interfaces.
After a quick peek at ltest_listener
and eunit_listener
they looked similar so I just wondered if it was possible to do the same thing. I have not inspected them enough to really check if this is possible. Could they do the same thing? Should they do the same thing?
Do they implement the behaviour or are they the call back modules?