def test_compile_do(self): engine = CompilationEngine("do draw();", "fakeOutputFile", True) engine.compile_do() self.assertEqual(engine.output, [ '<doStatement>', '<keyword> do </keyword>', '<identifier> draw </identifier>', '<symbol> ( </symbol>', '<expressionList>', '</expressionList>', '<symbol> ) </symbol>', '<symbol> ; </symbol>', '</doStatement>' ])
def test_compile_do_2(self): engine = CompilationEngine("field Square square; do square.dispose();", "fakeOutputFile", True) engine.compile_class_var_dec() engine.compile_do() self.assertEqual(engine.xml_output, [ '<classVarDec>', '<keyword> field </keyword>', '<identifier> Square, category: class, definedOrUsed: used </identifier>', '<identifier> square, category: field, definedOrUsed: defined, index: 0 </identifier>', '<symbol> ; </symbol>', '</classVarDec>', '<doStatement>', '<keyword> do </keyword>', '<identifier> square, category: field, definedOrUsed: used, index: 0 </identifier>', '<symbol> . </symbol>', '<identifier> dispose, category: subroutine, definedOrUsed: used </identifier>', '<symbol> ( </symbol>', '<expressionList>', '</expressionList>', '<symbol> ) </symbol>', '<symbol> ; </symbol>', '</doStatement>'])