public void Number_Recognition_Check() { TestUtility.CheckFile(testFileName, Stage.Ust, out RootUst ust); Assert.IsTrue(ust.AnyDescendantOrSelf(d => d is IntLiteral)); Assert.IsTrue(ust.AnyDescendantOrSelf(d => d is LongLiteral)); Assert.IsTrue(ust.AnyDescendantOrSelf(d => d is BigIntLiteral)); }
public void Parse_SyntaxErrorFileCSharp_CatchErrors() { var logger = new TestLogger(); TestUtility.CheckFile("ParseError.cs", Stage.ParseTree, logger, true); Assert.AreEqual(7, logger.ErrorCount); }
public void Match_HtmlTestPatterns_MatchedExpected() { IReadOnlyList <IMatchResultBase> result = TestUtility.CheckFile("Patterns.html", Stage.Match, isIgnoreFilenameWildcards: true); Assert.AreEqual(2, result.Count); Assert.AreEqual(TextSpan.FromBounds(94, 102), ((MatchResult)result[0]).TextSpan); var secondResult = (MatchResult)result[1]; Assert.AreEqual(TextSpan.FromBounds(71, 85), secondResult.TextSpans[0]); Assert.AreEqual(TextSpan.FromBounds(127, 135), secondResult.TextSpans[1]); }
public void Convert_JavaPatternsWithErrors_MatchedResultsEqual() { var patternsLogger = new LoggerMessageCounter(); TestUtility.CheckFile("Patterns.java", Stage.Match, patternsLogger); var patternWithErrorsLogger = new LoggerMessageCounter(); TestUtility.CheckFile("PatternsWithParseErrors.java", Stage.Match, patternWithErrorsLogger, true); Assert.AreEqual(-1, patternWithErrorsLogger.InfoMessageCount - patternsLogger.InfoMessageCount); }
public void Convert_PhpPatternsWithErrors_MatchedResultsEqual() { var patternsLogger = new TestLogger(); TestUtility.CheckFile("Patterns.php", Stage.Match, patternsLogger); var patternWithErrorsLogger = new TestLogger(); TestUtility.CheckFile("PatternsWithParseErrors.php", Stage.Match, patternWithErrorsLogger, true); Assert.AreEqual(patternsLogger.InfoMessageCount, patternWithErrorsLogger.InfoMessageCount); }
public void Convert_CSharp_BaseTypesExist() { string fileName = Path.Combine(TestUtility.GrammarsDirectory, "csharp", "not-ready-examples", "AllInOne.cs"); var workflowResults = TestUtility.CheckFile(fileName, Stage.Ust); var ust = workflowResults.Usts.First(); bool result = ust.AnyDescendant(descendant => { return(descendant is TypeDeclaration typeDeclaration && typeDeclaration.BaseTypes.Any(type => type.TypeText == nameof(IDisposable))); }); Assert.IsTrue(result, "Ust doesn't contain type declaration node with IDisposable base type"); }
public void Convert_Java_BaseTypesExist() { string fileName = Path.Combine(TestUtility.GrammarsDirectory, "java", "examples", "AllInOne7.java"); var workflowResults = TestUtility.CheckFile(fileName, Stage.Ust); var ust = workflowResults.Usts.First(); bool result = ust.AnyDescendant(descendant => { return(descendant is TypeDeclaration typeDeclaration && typeDeclaration.BaseTypes.Any(type => type.TypeText == "ActionListener")); }); Assert.IsTrue(result, "Ust doesn't contain type declaration node with ActionListener base type"); }
public void Check_AllDescendants_HaveParentsAfterConvert() { string fileName = Path.Combine(TestUtility.GrammarsDirectory, "csharp", "not-ready-examples", "AllInOne.cs"); WorkflowResult result = TestUtility.CheckFile(fileName, Stage.Ust); IEnumerable <Ust> descendantsExceptFirst = result.Usts.First().WhereDescendants().Skip(1); foreach (var descendant in descendantsExceptFirst) { if (!(descendant is RootUst)) { Assert.IsNotNull(descendant.Parent); } } }
public void Parse_AspxFile_WithoutErrors(string fileName) { TestUtility.CheckFile(fileName, Stage.Ust); }
public void Convert_CSharpAllInOne_WithoutErrors() { TestUtility.CheckFile(Path.Combine(TestUtility.GrammarsDirectory, "csharp", "not-ready-examples", "AllInOne.cs"), Stage.Ust); }
public void Parser_JavaFile_WithoutErrors(string fileName) { TestUtility.CheckFile(Path.Combine(TestUtility.GrammarsDirectory, "java", "examples", fileName), Stage.ParseTree); }
public void Parse_JavaSyntaxErrorFile_CatchErrors() { TestUtility.CheckFile("ParseError.java", Stage.ParseTree, shouldContainsErrors: true); }
public void Check_Array_Initializations() { string fileName = Path.Combine(TestUtility.TestsDataPath, "ArrayExamples.cs"); TestUtility.CheckFile(fileName, Stage.Ust, out RootUst ust); }
public void Convert_Java_WithoutErrors(string fileName) { TestUtility.CheckFile(Path.Combine(TestUtility.GrammarsDirectory, "java", "examples", fileName), Stage.Ust, maxStackSize: fileName == "ManyStringsConcat.java" ? 4000000 : 0); }
public void Convert_TSqlPattern_WithoutErrors() { TestUtility.CheckFile(Path.Combine(TestUtility.TestsDataPath, "tsql_patterns.sql"), Stage.Ust, language: Language.TSql); }
public void Parse_CSharpWithRoslyn() { TestUtility.CheckFile(Path.Combine(TestUtility.GrammarsDirectory, "csharp", "not-ready-examples", "AllInOne.cs"), Stage.ParseTree); }