def test_compile_while(self):
     engine = CompilationEngine("var int key; while (key = 0) {}", "fakeOutputFile", True)
     engine.compile_var_dec()
     engine.compile_while()
     self.assertEqual(engine.xml_output, [
         '<varDec>',
             '<keyword> var </keyword>',
             '<keyword> int </keyword>',
             '<identifier> key, category: local, definedOrUsed: defined, index: 0 </identifier>',
             '<symbol> ; </symbol>',
         '</varDec>',
         '<whileStatement>',
             '<keyword> while </keyword>',
             '<symbol> ( </symbol>',
             '<expression>',
                 '<term>',
                     '<identifier> key, category: local, definedOrUsed: used, index: 0 </identifier>',
                 '</term>',
                 '<symbol> = </symbol>',
                 '<term>',
                     '<integerConstant> 0 </integerConstant>',
                 '</term>',
             '</expression>',
             '<symbol> ) </symbol>',
             '<symbol> { </symbol>',
             '<statements>',
             '</statements>',
             '<symbol> } </symbol>',
         '</whileStatement>'])
 def test_compile_while(self):
     engine = CompilationEngine("while (key = 0) {}", "fakeOutputFile",
                                True)
     engine.compile_while()
     self.assertEqual(engine.output, [
         '<whileStatement>', '<keyword> while </keyword>',
         '<symbol> ( </symbol>', '<expression>', '<term>',
         '<identifier> key </identifier>', '</term>',
         '<symbol> = </symbol>', '<term>',
         '<integerConstant> 0 </integerConstant>', '</term>',
         '</expression>', '<symbol> ) </symbol>', '<symbol> { </symbol>',
         '<statements>', '</statements>', '<symbol> } </symbol>',
         '</whileStatement>'
     ])