示例#1
0
    def test_remove_redundant_jumps_false(self):
        arguments = [self.foo,
                   S('command', 'j', '$L1'),
                   S('label', '$L2'),
                   self.bar]
        block = B(arguments)

        remove_redundant_jumps(block)

        self.assertEqual(block.statements, arguments)
示例#2
0
    def test_remove_redundant_jumps_true(self):
        block = B([self.foo,
                   S('command', 'j', '$L1'),
                   S('label', '$L1'),
                   self.bar])

        remove_redundant_jumps(block)

        self.assertEqual(block.statements, [self.foo,
                                             S('label', '$L1'),
                                             self.bar])