diff --git a/_SUMMARY.md b/_SUMMARY.md index 68c5a6d97..275fe3d2c 100644 --- a/_SUMMARY.md +++ b/_SUMMARY.md @@ -71,7 +71,7 @@ * [Formatter Test](formatter_test.html) * [Rename Test](rename_test.html) * [Folding Test](folding_test.html) - * [Find Usages Test](TODO) + * [Find Usages Test](find_usages_test.html) * [Commenter Test](TODO) * [Reference Test](TODO) * [Plugin Development FAQ](faq.html) diff --git a/find_usages_test.md b/find_usages_test.md new file mode 100644 index 000000000..9de183e70 --- /dev/null +++ b/find_usages_test.md @@ -0,0 +1,62 @@ +--- +title: Find Usages Test +--- + + + +# {{ page.title }} + +In this test we will check if the find usages provider, implemented in the +[Find Usages Provider](find_usages_provider.html) +section of the +[Custom Language Support Tutorial](cls_tutorial.html), +works correctly. + +### 1. Define test data + +Create a file *FindUsagesTestData.simple*. + +```bash +# You are reading the ".properties" entry. +! The exclamation mark can also mark text as comments. +website = http://en.wikipedia.org/ + +language = English +# The backslash below tells the application to continue reading +# the value onto the next line. +message = Welcome to \ + Wikipedia! +# Add spaces to the key +key\ with\ spaces = This is the value that could be looked up with the key "key with spaces". +# Unicode +tab : \u0009 +``` + +Create a file *FindUsagesTestData.java*. + +```java +public class Test { + public static void main(String[] args) { + System.out.println("simple:website"); + } +} +``` + +### 2. Define a test method + +```java +public void testFindUsages() { + Collection usageInfos = myFixture.testFindUsages("FindUsagesTestData.simple", "FindUsagesTestData.java"); + assertEquals(1, usageInfos.size()); +} +``` + +### 3. Run the test + +Run the test and make sure it's green. + +----- + +[Previous](folding_test.html) [Top](writing_tests_for_plugins.html) [Next](commenter_test.html) diff --git a/writing_tests_for_plugins.md b/writing_tests_for_plugins.md index 647623dcd..d94407718 100644 --- a/writing_tests_for_plugins.md +++ b/writing_tests_for_plugins.md @@ -21,7 +21,7 @@ and cover its code with functional tests. * [Formatter Test](formatter_test.html) * [Rename Test](rename_test.html) * [Folding Test](folding_test.html) -* [Find Usages Test](TODO) +* [Find Usages Test](find_usages_test.html) * [Commenter Test](TODO) * [Reference Test](TODO)