[Gambas-user] Crash with latest version

Christof Thalhofer chrisml at deganius.de
Thu Feb 11 14:08:08 CET 2021


Am 11.02.21 um 01:02 schrieb Jussi Lahtinen:

> I don't quite follow your explanation. Can you give me an example
> project on how to use it?
> I did not say that the test suite causes side-effects, I said it
> prevents them from being exposed.
> 
> The tester I have used (it has exposed a lot of bugs!) is in the
> software farm with the name GambasTester.
> I don't think it is translatable to the test suite as it has a very
> different philosophy behind it.
> I think your test suite is the best option for testing code you have
> written with Gambas. And what I wrote is more like cumulative fuzzer output.

Ok, I'll have a look at it.

gb.test's main task is running and documentation of tests.

gb.test handles and reports crashes. So if you want to crash Gambas and
want to get reported that a specific crash "is good", gb.text is able to
handle that and report it.

For example you can see gb.test here, it's a Gambas project you can run
independently on your machine. Its in the sources here:

gambas3/main/lib/test/gb.test/

https://gitlab.com/gambas/gambas/-/tree/master/main/lib/test/gb.test

It has tests to test itself in the 'TestMyself' folder. You can play
around with these. In the 'TCrashes' test module you find this (it will
create a crash and the test will fail because of this):

> Public Sub DoACrash()
> 
>     Dim a As Long
> 
>     'This is a crash
>     a = 3 / 0
> 
> End

If you choose it with 'Shift-F4' and then run it with 'F4' gb.test will
report for this special test:

'not ok 1 - TCrashes:DoACrash'

But you can revert the output of gb.test (with Test.IntendedFailure) and
say that there is an error if the crash does not happen!

> Public Sub DoACrash()
> 
>     Dim a As Long
> 
>     Test.IntendedFailure()
> 
>     'This is a crash
>     a = 3 / 0
> 
> End

Then gb.test reports:

"ok 1 - TCrashes:DoACrash crashed with error 'Division by zero'"

And if the crash does not happen (for instance if 'a = 3') then gb.test
reports:

'not ok 1 - TCrashes:DoACrash'

Alles Gute

Christof Thalhofer

-- 
Dies ist keine Signatur

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


More information about the User mailing list