Ejemplo n.º 1
0
 def test_classdef_removes_semicolon_superclass(self):
     # Semicolon is probably a result of our semicolon-adding elsewhere
     # We should fix that first!
     h = HaxeTransformer()
     data = [Token("NAME", 'AssetPaths'), ';']
     output = h.classdef(data)
     self.assertIn("class AssetPaths", output)
     self.assertNotIn(";", output)
Ejemplo n.º 2
0
    def test_classdef_creates_non_base_class(self):
        h = HaxeTransformer()
        data = [Token("NAME", 'Monster'), [''], 'function new() { super() }']
        output = h.classdef(data)

        self.assertIn("class Monster", output)
        self.assertIn("()", output)
        self.assertIn("{", output)
        self.assertIn("}", output)
Ejemplo n.º 3
0
    def test_classdef_creates_subclass(self):
        h = HaxeTransformer()
        data = [
            Token("NAME", 'Main'), ['Sprite'],
            'function new() { super().__init__()\nself.addChild(new FlxGame(0, 0, PlayState)) }'
        ]
        output = h.classdef(data)

        self.assertIn("class Main extends Sprite", output)
        self.assertIn("{", output)
        self.assertIn("}", output)
        self.assertIn("addChild", output)