diff options
author | George Fraser <george@fivetran.com> | 2018-12-29 13:41:06 -0800 |
---|---|---|
committer | George Fraser <george@fivetran.com> | 2018-12-29 13:41:06 -0800 |
commit | 9f9ae3a6ed1f0e20e50ef117f39bbcd439bd653c (patch) | |
tree | 94003c6a29b389b2d79bba2d407137312eecd58c /src/test/java | |
parent | d238854b707688806f9f33c60eaf9812d42674c9 (diff) | |
download | java-language-server-9f9ae3a6ed1f0e20e50ef117f39bbcd439bd653c.zip |
Speed up containsWordMatching
Diffstat (limited to 'src/test/java')
-rw-r--r-- | src/test/java/org/javacs/ParserTest.java | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/src/test/java/org/javacs/ParserTest.java b/src/test/java/org/javacs/ParserTest.java index 580ce92..d207055 100644 --- a/src/test/java/org/javacs/ParserTest.java +++ b/src/test/java/org/javacs/ParserTest.java @@ -16,6 +16,27 @@ public class ParserTest { assertTrue(Parser.matchesTitleCase("AutocompleteBetweenLines", "ABetweenLines")); assertTrue(Parser.matchesTitleCase("UPPERFooBar", "fb")); assertFalse(Parser.matchesTitleCase("Foobar", "fb")); + + assertTrue(Parser.matchesTitleCase("Prefix FooBar", "fb")); + assertTrue(Parser.matchesTitleCase("Prefix FooBar", "fob")); + assertTrue(Parser.matchesTitleCase("Prefix AnyPrefixFooBar", "fb")); + assertTrue(Parser.matchesTitleCase("Prefix AutocompleteBetweenLines", "ABetweenLines")); + assertTrue(Parser.matchesTitleCase("Prefix UPPERFooBar", "fb")); + assertFalse(Parser.matchesTitleCase("Foo Bar", "fb")); + } + + @Test + public void searchLargeFile() { + var largeFile = Paths.get(FindResource.uri("/org/javacs/example/LargeFile.java")); + assertTrue(Parser.containsWordMatching(largeFile, "removeMethodBodies")); + assertFalse(Parser.containsWordMatching(largeFile, "removeMethodBodiez")); + } + + @Test + public void searchSmallFile() { + var smallFile = Paths.get(FindResource.uri("/org/javacs/example/Goto.java")); + assertTrue(Parser.containsWordMatching(smallFile, "nonDefaultConstructor")); + assertFalse(Parser.containsWordMatching(smallFile, "removeMethodBodies")); } @Test |