custom language testing tutorial: add header note

This commit is contained in:
Yann Cébron 2021-11-30 13:54:44 +01:00
parent 53ee52e1c0
commit a7aac0e482
11 changed files with 40 additions and 13 deletions

View File

@ -2,6 +2,8 @@
<!-- Copyright 2000-2021 JetBrains s.r.o. and other contributors. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. -->
<include src="tests_prerequisites.md" include-id="custom_language_testing_tutorial_header"></include>
This test checks if the Simple Language annotator functionality, implemented in the [Annotator](annotator.md) section of the Custom Language Support Tutorial, works as expected.
## Define Input Test Data
@ -31,4 +33,4 @@ It then calls the `checkHighlighting()` method to verify weak warnings.
{src="simple_language_plugin/src/test/java/org/intellij/sdk/language/SimpleCodeInsightTest.java" include-symbol="testAnnotator"}
## Run the Test
[Run](completion_test.md#run-the-test) the test and make sure it's green.
[Run](completion_test.md#run-the-test) the test and make sure it's green.

View File

@ -2,6 +2,8 @@
<!-- Copyright 2000-2021 JetBrains s.r.o. and other contributors. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. -->
<include src="tests_prerequisites.md" include-id="custom_language_testing_tutorial_header"></include>
This test will check if the commenter, implemented in the [Commenter](commenter.md) section of the Custom Language Support Tutorial, works as expected.
## Define a Test Method
@ -15,4 +17,4 @@ It again calls the line comment action to remove the comment character and verif
{src="simple_language_plugin/src/test/java/org/intellij/sdk/language/SimpleCodeInsightTest.java" include-symbol="testCommenter"}
## Run the Test
[Run](completion_test.md#run-the-test) the test and make sure it's green.
[Run](completion_test.md#run-the-test) the test and make sure it's green.

View File

@ -2,6 +2,8 @@
<!-- Copyright 2000-2021 JetBrains s.r.o. and other contributors. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. -->
<include src="tests_prerequisites.md" include-id="custom_language_testing_tutorial_header"></include>
This test checks if the Simple Language code completion functionality, implemented in the [Reference Contributor](reference_contributor.md) section of the Custom Language Support Tutorial, works as expected.
## Define Test Data
@ -21,7 +23,7 @@ This file contains a Simple Language reference within the Java code at `<caret>`
## Define a Test
Subclass [`LightJavaCodeInsightFixtureTestCase`](upsource:///java/testFramework/src/com/intellij/testFramework/fixtures/LightJavaCodeInsightFixtureTestCase.java) to create `SimpleCodeInsightTest`.
Override `getTestDataPath()`, and return the path from the root of this plugin module to the <path>testData</path> directory.
```java
```
{src="simple_language_plugin/src/test/java/org/intellij/sdk/language/SimpleCodeInsightTest.java" include-symbol="getTestDataPath"}
@ -39,7 +41,7 @@ This method:
{src="simple_language_plugin/src/test/java/org/intellij/sdk/language/SimpleCodeInsightTest.java" include-symbol="testCompletion"}
A number of related methods exist in `CodeInsightTestFixture` for testing completion and lookup elements, e.g., when testing completion variants and requiring only one testdata file `CodeInsightTestFixture.testCompletionVariants()`.
A number of related methods exist in `CodeInsightTestFixture` for testing completion and lookup elements, e.g., when testing completion variants and requiring only one testdata file `CodeInsightTestFixture.testCompletionVariants()`.
## Run the Test
[Run](completion_test.md#run-the-test) the test and make sure it's green.
[Run](completion_test.md#run-the-test) the test and make sure it's green.

View File

@ -2,6 +2,8 @@
<!-- Copyright 2000-2021 JetBrains s.r.o. and other contributors. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. -->
<include src="tests_prerequisites.md" include-id="custom_language_testing_tutorial_header"></include>
This test will check if the documentation provider, implemented in the [Documentation](documentation_provider.md) section of the Custom Language Support Tutorial, works as expected.
## Define a Test Method
@ -9,7 +11,7 @@ Add the `testDocumentation()` method to the `SimpleCodeInsightTest` class [previ
This test uses the files <path>DocumentationTestData.java</path> and <path>DocumentationTestData.simple</path> from the <path>testData</path> directory
to construct a test project and opens the first one in the editor with the virtual caret positioned at the usage of the Simple Language property.
Using the `DocumentationManager`, it checks if a target element for documentation is found, retrieves the documentation provider for the
Using the `DocumentationManager`, it checks if a target element for documentation is found, retrieves the documentation provider for the
Simple Language and creates the documentation string for the target element.
Finally, the documentation string is verified against the expected output.
@ -18,4 +20,4 @@ Finally, the documentation string is verified against the expected output.
{src="simple_language_plugin/src/test/java/org/intellij/sdk/language/SimpleCodeInsightTest.java" include-symbol="testDocumentation"}
## Run the Test
[Run](completion_test.md#run-the-test) the test and make sure it's green.
[Run](completion_test.md#run-the-test) the test and make sure it's green.

View File

@ -2,6 +2,8 @@
<!-- Copyright 2000-2021 JetBrains s.r.o. and other contributors. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. -->
<include src="tests_prerequisites.md" include-id="custom_language_testing_tutorial_header"></include>
This test ensures the find usages provider, implemented in the [Find Usages Provider](find_usages_provider.md) section of the Custom Language Support Tutorial, works correctly.
## Define the Test Data
@ -27,4 +29,4 @@ This test verifies the find usage functionality will identify the "key with spac
## Run the Test
[Run](completion_test.md#run-the-test) the test and make sure it's green.
[Run](completion_test.md#run-the-test) the test and make sure it's green.

View File

@ -2,6 +2,8 @@
<!-- Copyright 2000-2021 JetBrains s.r.o. and other contributors. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. -->
<include src="tests_prerequisites.md" include-id="custom_language_testing_tutorial_header"></include>
This test verifies the Simple Language folding builder, implemented in the [Folding Builder](folding_builder.md) section of the Custom Language Support Tutorial, works as expected.
> A folding builder must implement [`DumbAware`](upsource:///platform/core-api/src/com/intellij/openapi/project/DumbAware.java) to pass tests. See [Define a Folding Builder](folding_builder.md#define-a-folding-builder) for more information.
@ -26,4 +28,4 @@ This test method reuses the <path>DefaultTestData.simple</path> Simple file.
## Run the Test
[Run](completion_test.md#run-the-test) the test and make sure it's green.
[Run](completion_test.md#run-the-test) the test and make sure it's green.

View File

@ -2,6 +2,8 @@
<!-- Copyright 2000-2021 JetBrains s.r.o. and other contributors. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. -->
<include src="tests_prerequisites.md" include-id="custom_language_testing_tutorial_header"></include>
This test checks if the Simple Language formatter, implemented in the [Formatter](formatter.md) section of the Custom Language Support Tutorial, works as expected.
> See also [`FormatterTestCase`](upsource:///platform/testFramework/src/com/intellij/psi/formatter/FormatterTestCase.java) as convenient base class.

View File

@ -2,8 +2,10 @@
<!-- Copyright 2000-2021 JetBrains s.r.o. and other contributors. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. -->
<include src="tests_prerequisites.md" include-id="custom_language_testing_tutorial_header"></include>
The first test checks if the Simple Language parser, implemented in the [Lexer and Parser Definition](lexer_and_parser_definition.md) section of the Custom Language Support Tutorial, works as expected.
For more complex Lexers (e.g., having additional logic), it is advisable to add separate tests inheriting from [`LexerTestCase`](upsource:///platform/testFramework/src/com/intellij/testFramework/LexerTestCase.java).
## Update Grammar and Regenerate the Parser

View File

@ -2,6 +2,8 @@
<!-- Copyright 2000-2021 JetBrains s.r.o. and other contributors. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. -->
<include src="tests_prerequisites.md" include-id="custom_language_testing_tutorial_header"></include>
This test checks if references functionality, implemented in the [Reference Contributor](reference_contributor.md) section of the Custom Language Support Tutorial, works as expected.
## Define Test Data
@ -25,4 +27,4 @@ The fixture gets the `PsiReference` at the caret position, and then asserts the
## Run the Test
[Run](completion_test.md#run-the-test) the test and make sure it's green.
[Run](completion_test.md#run-the-test) the test and make sure it's green.

View File

@ -2,6 +2,8 @@
<!-- Copyright 2000-2021 JetBrains s.r.o. and other contributors. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. -->
<include src="tests_prerequisites.md" include-id="custom_language_testing_tutorial_header"></include>
This test verifies the Simple Language in-place rename functionality, implemented in the [Reference Contributor](reference_contributor.md) section of the Custom Language Support Tutorial, works as expected.
## Define Input Test Data
@ -39,4 +41,4 @@ Add the `testRename()` method to the `SimpleCodeInsightTest` class [previously d
## Run the Test
[Run](completion_test.md#run-the-test) the test and make sure it's green.
[Run](completion_test.md#run-the-test) the test and make sure it's green.

View File

@ -2,6 +2,13 @@
<!-- Copyright 2000-2021 JetBrains s.r.o. and other contributors. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. -->
<chunk id="custom_language_testing_tutorial_header">
> This page is part of multi step [](writing_tests_for_plugins.md) tutorial.
{type="tip"}
</chunk>
This page discusses the steps to configure a plugin project for creating tests.
## Create a Folder for Tests
@ -31,4 +38,4 @@ For example, on macOS it might be <path>/Users/$USER_NAME$/Documents/intellij-co
test {
systemProperty "idea.home.path", "/path/to/intellij-community/"
}
```
```