Exemplo n.º 1
0
    def test_is_used_assignment_need_compile_would_return_true(self):
        handler = CodeHandler()

        declared_block = Block("a := 1")
        block = Block("a.get()")

        handler._blocks.append(declared_block)
        handler._blocks.append(block)
        handler.add_declared("a", declared_block)

        result = handler.need_compile(block)

        self.assertTrue(result)
Exemplo n.º 2
0
    def test_is_need_compile_would_return_true_if_not_assignment_code(self):
        handler = CodeHandler()

        declared_block = Block("var a string")
        block = Block("fmt.Println(a)")

        handler._blocks.append(declared_block)
        handler._blocks.append(block)
        handler.add_declared("a", declared_block)
        handler.assignment_manager.add_assigned("a", handler.handler_type)

        result = handler.need_compile(block)

        self.assertTrue(result)