AjScript.Tests.Interpreter.ParserTests.ParseSimpleNamedFunction C# (CSharp) Method

ParseSimpleNamedFunction() private method

private ParseSimpleNamedFunction ( ) : void
return void
        public void ParseSimpleNamedFunction()
        {
            IExpression expression = this.ParseExpression("function add1(x) { return x+1;}");
            Assert.IsNotNull(expression);
            Assert.IsInstanceOfType(expression, typeof(FunctionExpression));

            FunctionExpression funexpr = (FunctionExpression)expression;

            Assert.IsInstanceOfType(funexpr.Body, typeof(CompositeCommand));
            Assert.AreEqual(1, funexpr.ParameterNames.Length);
            Assert.AreEqual("add1", funexpr.Name);
        }
ParserTests