public void VisitFunctionCallExpression(AstFunctionCallExpression functionCallExpression) { Assert.IsType <AstFunctionCallExpression>(this.expected); var expectedAst = (AstFunctionCallExpression)this.expected; Assert.Equal(expectedAst.MethodCall, functionCallExpression.MethodCall); Assert.True(expectedAst.Arguments.Length == functionCallExpression.Arguments.Length, "Expected length of arguments is not equal to actual"); for (int i = 0; i < functionCallExpression.Arguments.Length; i++) { AssertVisit(expectedAst.Arguments[i], functionCallExpression.Arguments[i]); } }
public void ParseFactor_ParsingFunctionWithArgumentsCall() { var expectedArguments = new AstExpression[] { new AstNumberExpression { Value = "1" }, new AstBinaryExpression { Operator = CmdTokenKind.Plus, Lhs = new AstNumberExpression { Value = "2" }, Rhs = new AstNumberExpression { Value = "3" }, } }; var expectedAst = new AstFunctionCallExpression("ExampleCall", expectedArguments); AstAssert.Factor(expectedAst, "ExampleCall(1, 2+3)"); }
public void ParseFactor_ParsingFunctionWithoutArgumentsCall() { var expectedAst = new AstFunctionCallExpression("GetKeys"); AstAssert.Factor(expectedAst, "GetKeys()"); }