Wiki

Ticket #309 (new enhancement)

Opened 5 years ago

Last modified 5 years ago

tests in mixins

Reported by: kobi7 Owned by:
Priority: major Milestone:
Component: Cobra Compiler Version: 0.8.0
Keywords: Cc:

Description

can we have tests in mixins?
initializing the mixin, like a normal class, and then asserting.
I currently refer to tests in the mixin's body, not the method's body.

for example:

mixin ABC
    var h = 3
    test
        p = ABC()
        assert p.h == 3

Change History

Changed 5 years ago by kobi7

currently in svn 2848.
the error I get is "The modifier static is not valid for this item"
referring to the 'test' keyword.

Changed 5 years ago by hopscc

  • type changed from defect to enhancement

Changed 5 years ago by nerdzero

You can create a helper class as a workaround.

mixin ABC
    var h =3
		
class ABCTest adds ABC
    test
        p = ABCTest()
        assert p.h == 3
		
    def main
        pass
Note: See TracTickets for help on using tickets.