public void WhileStatementRequiresConditionAndStatement() { var statement = new WhileStatement(); Expect.Throw<InvalidOperationException>(() => statement.ToString()); statement.Condition = true; Expect.Throw<InvalidOperationException>(() => statement.ToString()); statement.Statement = JS.Empty(); Assert.AreEqual("while(true);", statement.ToString()); }
public void WhileStatementRequiresConditionAndStatement() { var statement = new WhileStatement(); Expect.Throw <InvalidOperationException>(() => statement.ToString()); statement.Condition = true; Expect.Throw <InvalidOperationException>(() => statement.ToString()); statement.Statement = JS.Empty(); Assert.AreEqual("while(true);", statement.ToString()); }
public AstPrinterNode Visit(WhileStatement node) { var printer = new AstPrinterNode(node.ToString()); printer.AddChild(node.Expression.Accept(this)); printer.AddChild(node.Statement.Accept(this)); return(printer); }
public void WhileStatementProducesEmptyWhile() { var statement = new WhileStatement(); statement.Condition = true; statement.Statement = JS.Empty(); Assert.AreEqual("true;", statement.Condition.ToString()); Assert.AreEqual(";", statement.Statement.ToString()); Assert.AreEqual("while(true);", statement.ToString()); }
public void WhileStatementProducesEmptyWhile() { var statement = new WhileStatement(); statement.Condition = true; statement.Statement = JS.Empty(); Assert.AreEqual("true;", statement.Condition.ToString()); Assert.AreEqual(";", statement.Statement.ToString()); Assert.AreEqual("while(true);", statement.ToString()); }