[Gambas-user] New component gb.test

Christof Thalhofer chrisml at deganius.de
Mon May 21 16:55:22 CEST 2018


Am 20.05.2018 um 20:04 schrieb Tobias Boege:

> If you don't Setup, the TapPrinter will keep track of the number of tests
> you ran and spoof a plan at the end. Currently you have to call the
> Finish() method for it to do that. Given how the Assert module is used,
> maybe that should be made automatic somehow.
> 
> [ Actually, I think the TapParser doesn't throw an error yet if it doesn't
>   encounter a plan line, which is a nuance I have likely overlooked. ]

A premature ending is not reported.

If I insert

"Assert.IsType(1 / 0, gb.Integer, "Crash")"

in TestAsserts as the last line in Main(), then the execution

gbx3 -s TestAsserts
/home/christof/programming/gambas/gambas/comp/src/gb.test

outputs:

1..10
ok 1 - True is ok
ok 2 - False is not ok
ok 3 - Multiplication
ok 4 - Gambas is sufficiently fast
ok 5 - Float absolute error
not ok 6 - Float relative error # SKIP Intentionally wrong
ok 7 - Float relative error
ok 8 - CStr returns a String
ok 9 - LIKE email address
ok 10 - MATCH email address
ok 11 - not MATCH email address
TestAsserts.Main.21: #26: Division by zero
TestAsserts.Main.21

Tester outputs:

Test # 2: TestAsserts
Planned tests: 0
Exit code:     1
Run tests:     0
Duration:      0s
--------------------
Passed tests:  0
Failed tests:  0
Skipped tests: 0
To-do tests:   0
Bonus:         0
Status:        FAILED
****************************************

Thats not good. Just the exit code says, that sth crashed, but
TestHarness.Current neither knows where it crashed nor what crashed nor
contains the number of passed tests.

Shouldn't it?

Alles Gute

Christof Thalhofer

-- 
Dies ist keine Signatur

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: OpenPGP digital signature
URL: <http://lists.gambas-basic.org/pipermail/user/attachments/20180521/28af23a5/attachment.sig>


More information about the User mailing list