Пример #1
0
 public void FunctionWithMixedParameters()
 {
     ParseAssert.IsParsedTo <AstFunctionDefinition>(
         "function X(integer a, b, boolean c)\r\nend",
         f => f.Name == "X" && // not checking parameter types, too complex
         f.Parameters.Select(p => p.Name).SequenceEqual(new[] { "a", "b", "c" })
         );
 }
Пример #2
0
 public void FunctionWithTypedParameters()
 {
     ParseAssert.IsParsedTo <AstFunctionDefinition>(
         "function X(integer a, string b, boolean c)\r\nend",
         f => f.Name == "X" &&
         f.Parameters.Select(p => p.Type).Cast <AstUnknownType>().Select(t => t.Name).SequenceEqual(new[] { "integer", "string", "boolean" }) &&
         f.Parameters.Select(p => p.Name).SequenceEqual(new[] { "a", "b", "c" })
         );
 }
Пример #3
0
 public void FunctionWithUntypedParameters()
 {
     ParseAssert.IsParsedTo <AstFunctionDefinition>(
         "function X(a, b, c)\r\nend",
         f => f.Name == "X" &&
         f.Parameters.All(p => p.Type is AstImplicitType) &&
         f.Parameters.Select(p => p.Name).SequenceEqual(new[] { "a", "b", "c" })
         );
 }
Пример #4
0
        public void TypedAutoPropertyWithoutAssignment(string accessModifier)
        {
            var code = string.Format(@"
                class X
                    {0} string x
                end
            ", accessModifier).Trim();

            ParseAssert.IsParsedTo(
                code, r => r.Descendant <AstPropertyDefinition>(),
                f => f.Name == "x" && f.Type.Name == "string"
                );
        }
Пример #5
0
 public void Object(string literal, string expectedResult)
 {
     ParseAssert.IsParsedTo(literal, expectedResult);
 }
Пример #6
0
 public void Boolean(string literal, string expectedResult)
 {
     ParseAssert.IsParsedTo(literal, expectedResult, includeExpressionType: true);
 }
Пример #7
0
 public void SingleLineNested(string code, string parsed)
 {
     ParseAssert.IsParsedTo(code, parsed);
 }
Пример #8
0
 public void FunctionWithNoParameters()
 {
     ParseAssert.IsParsedTo <AstFunctionDefinition>("function X()\r\nend", f => f.Name == "X");
 }
Пример #9
0
 public void Types(string code, string definitionType)
 {
     ParseAssert.IsParsedTo <AstTypeDefinition>(code, t => t.Name == "X" && t.DefinitionType == definitionType);
 }
Пример #10
0
 public void Binary_Precedence(string code, string expectedResult)
 {
     ParseAssert.IsParsedTo(code, expectedResult, parenthiseAll: true);
 }
Пример #11
0
 public void Binary_Boolean(string code, string expectedResult)
 {
     ParseAssert.IsParsedTo(code, expectedResult);
 }
Пример #12
0
 public void Binary_Comparison(string code, string expectedResult)
 {
     ParseAssert.IsParsedTo(code, expectedResult);
 }
Пример #13
0
 public void Indexer(string code, string expectedResult)
 {
     ParseAssert.IsParsedTo(code, expectedResult);
 }
Пример #14
0
 public void Simple(string code, string expectedResult)
 {
     ParseAssert.IsParsedTo(code, expectedResult);
 }