[Gambas-user] Coming back to gb.test

Tobias Boege taboege at gmail.com
Thu May 7 09:59:46 CEST 2020


On Thu, 07 May 2020, Christof Thalhofer wrote:
> Am 07.05.20 um 08:25 schrieb Benoît Minisini:
> 
> > If a class needs to be exported (so that the component works), but 
> > should not be used by the final user, I prefix the class name with an 
> > underscore.
> 
> Ok, I think we'll have to do that for TestAssertion and TapContext.
> 
> AFAIK Tap and TestStats must not be exported.
> 
> Tobi? Are you watching?
> 

TestAssertion and TapContext objects are definitely returned by public
methods. It would be nice if autocompletion in the IDE works for those,
but otherwise they can be hidden, as they are only consumed by users.

I think it would not break anything to unexport TapParser and TapPrinter,
leaving only the high-level interfaces of Assert / Test (TAP out) and
TestHarness (TAP in). With this done, there pretty much no reason to
export TapContext anymore either, the only two references being in
TapPrinter.Session and Test.Session, both for internal usage by gb.test.
This eliminates almost every mention of TAP in the component's interface.

The Tap class contains constants that are referred to by TestAssertion,
maybe the constants can be moved into TestAssertion (whose existence is
the result of a very recent refactoring). Then Tap can go as well.

TestStats is supposed to be the summary of a test run produced by the
TestHarness class. It was written so that a TAP parser, like soon the
IDE, just has to pipe `gbx3 -T ...` into TestHarness and get out an
object representation of the test result (plus ability to zoom in as
far as to individual assertions). It can be hidden for the same reason
as TestAssertion and TapContext but should remain exported.

Should I attempt to do these things?

As for the "allocations non-freed" warning: that's a lot of allocations.
The data structures that keep testing information during the test run
(TestAssertion and TapContext) are strictly hierarchical, so I don't think
there is a real circular reference at this point. The message only appears
in the BailOut test, too.

Benoît: is this expected given that there is a hard `Quit 1` deep down
the call stack of a method from an object which references lots of data?
I imagine that the object is referenced while one of its methods execute
and when that execution results in a Quit, the object cannot be freed
while the interpreter shuts down?

Regards,
Tobias

-- 
"There's an old saying: Don't change anything... ever!" -- Mr. Monk
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <https://lists.gambas-basic.org/pipermail/user/attachments/20200507/c1fb1bfc/attachment.sig>


More information about the User mailing list