Пример #1
0
 public void ParsesCorrectlyWithoutAnElseBlock()
 {
     classUnderTest.LoadTokens(t1, t2, t3, t4, t5, t6, t7, t8, t9, t10, t11, t12, t13, t14);
     classUnderTest.AddToSymbolTable("x", IdentifierKind.Static, null);
     classUnderTest.ParseIfStatement().ShouldGenerateXml(@"
         <ifStatement>
           <keyword>if</keyword>
           <symbol>(</symbol>
           <expression>
             <term>
                 <symbol>(</symbol>
                 <expression>
                     <term>
                         <identifier kind='static' isDefinition='false' number='0'>x</identifier>
                     </term>
                     <symbol>*</symbol>
                     <term>
                         <integerConstant>5</integerConstant>
                     </term>
                 </expression>
                 <symbol>)</symbol>
             </term>
             <symbol>&gt;</symbol>
             <term>
                 <integerConstant>30</integerConstant>
             </term>
         </expression>
         <symbol>)</symbol>
         <symbol>{</symbol>
         <statements>
             <returnStatement>
               <keyword>return</keyword>
               <symbol>;</symbol>
             </returnStatement>
         </statements>
         <symbol>}</symbol>
       </ifStatement>
     ");
 }
 public void ParsesCorrectlyWithoutAnElseBlock()
 {
     classUnderTest.LoadTokens(t1, t2, t3, t4, t5, t6, t7, t8, t9, t10, t11, t12, t13, t14);
     classUnderTest.ParseIfStatement().ShouldGenerateXml(@"
         <ifStatement>
           <keyword>if</keyword>
           <symbol>(</symbol>
           <expression>
             <term>
                 <symbol>(</symbol>
                 <expression>
                     <term>
                         <identifier>x</identifier>
                     </term>
                     <symbol>*</symbol>
                     <term>
                         <integerConstant>5</integerConstant>
                     </term>
                 </expression>
                 <symbol>)</symbol>
             </term>
             <symbol>&gt;</symbol>
             <term>
                 <integerConstant>30</integerConstant>
             </term>
         </expression>
         <symbol>)</symbol>
         <symbol>{</symbol>
         <statements>
             <returnStatement>
               <keyword>return</keyword>
               <symbol>;</symbol>
             </returnStatement>
         </statements>
         <symbol>}</symbol>
       </ifStatement>
     ");
 }