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" }) ); }
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" }) ); }
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" }) ); }
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" ); }
public void Object(string literal, string expectedResult) { ParseAssert.IsParsedTo(literal, expectedResult); }
public void Boolean(string literal, string expectedResult) { ParseAssert.IsParsedTo(literal, expectedResult, includeExpressionType: true); }
public void SingleLineNested(string code, string parsed) { ParseAssert.IsParsedTo(code, parsed); }
public void FunctionWithNoParameters() { ParseAssert.IsParsedTo <AstFunctionDefinition>("function X()\r\nend", f => f.Name == "X"); }
public void Types(string code, string definitionType) { ParseAssert.IsParsedTo <AstTypeDefinition>(code, t => t.Name == "X" && t.DefinitionType == definitionType); }
public void Binary_Precedence(string code, string expectedResult) { ParseAssert.IsParsedTo(code, expectedResult, parenthiseAll: true); }
public void Binary_Boolean(string code, string expectedResult) { ParseAssert.IsParsedTo(code, expectedResult); }
public void Binary_Comparison(string code, string expectedResult) { ParseAssert.IsParsedTo(code, expectedResult); }
public void Indexer(string code, string expectedResult) { ParseAssert.IsParsedTo(code, expectedResult); }
public void Simple(string code, string expectedResult) { ParseAssert.IsParsedTo(code, expectedResult); }