public void Simplify_JavaCodeWithConstantCharArray_ArrayFolded() { TextFile source = TextFile.Read(Path.Combine(TestUtility.TestsDataPath, "FoldArrayOfChars.java")); var matches = PatternMatchingUtils.GetMatches(source, "<[\"none\"]>", Language.Java); Assert.AreEqual(new LineColumnTextSpan(3, 21, 3, 44), matches[0].LineColumnTextSpan); // TODO: should be (3, 20, 3, 42) }
public void Simplify_PhpCodeWithConstants_ConstantsFolded() { TextFile source = TextFile.Read(Path.Combine(TestUtility.TestsDataPath, "simplify-sample.php")); var matches = PatternMatchingUtils.GetMatches(source, "<[\"Hello World!\"]>", Language.Php); Assert.AreEqual(new LineColumnTextSpan(2, 7, 2, 29), matches[0].LineColumnTextSpan); // TODO: should be (2, 8, 2, 30) matches = PatternMatchingUtils.GetMatches(source, "<[86400]>", Language.Php); Assert.AreEqual(new LineColumnTextSpan(3, 6, 3, 18), matches[0].LineColumnTextSpan); matches = PatternMatchingUtils.GetMatches(source, "<[42]>", Language.Php); Assert.AreEqual(new LineColumnTextSpan(4, 6, 4, 15), matches[0].LineColumnTextSpan); matches = PatternMatchingUtils.GetMatches(source, "<[-3]>", Language.Php); Assert.AreEqual(new LineColumnTextSpan(5, 6, 5, 8), matches[0].LineColumnTextSpan); //matches = PatternMatchingUtils.GetMatches(code, "<[-3.1]>", Language.Php); // TODO: fix float literal patterns //Assert.AreEqual(new LineColumnTextSpan(6, 6, 6, 10), matches.Length); }
public void Match_Big_Integer() { var sourceFile = TextFile.Read(testFileName); var matches = PatternMatchingUtils.GetMatches(sourceFile, "<[9223372036854775807123456]>", Language.Php); Assert.AreEqual(1, matches.Length); }