mirror of
https://github.com/JetBrains/intellij-sdk-code-samples.git
synced 2025-07-30 18:27:49 +08:00
[site] Rename test
This commit is contained in:
parent
a874c53175
commit
14d1c7b86f
@ -69,7 +69,7 @@
|
||||
* [Completion Test](completion_test.html)
|
||||
* [Annotator Test](annotator_test.html)
|
||||
* [Formatter Test](formatter_test.html)
|
||||
* [Rename Test](TODO)
|
||||
* [Rename Test](rename_test.html)
|
||||
* [Folding Test](TODO)
|
||||
* [Find Usages Test](TODO)
|
||||
* [Commenter Test](TODO)
|
||||
|
82
rename_test.md
Normal file
82
rename_test.md
Normal file
@ -0,0 +1,82 @@
|
||||
---
|
||||
title: Rename Test
|
||||
---
|
||||
|
||||
<!--
|
||||
INITIAL_SOURCE https://confluence.jetbrains.com/display/IntelliJIDEA/Rename+Test
|
||||
-->
|
||||
|
||||
# {{ page.title }}
|
||||
|
||||
In this test we will check if in-place rename, implemented in the
|
||||
[Reference Contributor](reference_contributor.html)
|
||||
section of the
|
||||
[Custom Language Support Tutorial](cls_tutorial.html), works as we expect.
|
||||
|
||||
### 1. Define input test data
|
||||
|
||||
Create a file *RenameTestData.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 *RenameTestData.java*.
|
||||
|
||||
```java
|
||||
public class Test {
|
||||
public static void main(String[] args) {
|
||||
System.out.println("simple:website<caret>");
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### 2. Create output test data
|
||||
|
||||
Create a file *RenameTestDataAfter.simple*.
|
||||
|
||||
```bash
|
||||
# You are reading the ".properties" entry.
|
||||
! The exclamation mark can also mark text as comments.
|
||||
websiteUrl = 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
|
||||
```
|
||||
|
||||
### 3. Define a test method
|
||||
|
||||
```java
|
||||
public void testRename() {
|
||||
myFixture.configureByFiles("RenameTestData.java", "RenameTestData.simple");
|
||||
myFixture.renameElementAtCaret("websiteUrl");
|
||||
myFixture.checkResultByFile("RenameTestData.simple", "RenameTestDataAfter.simple", false);
|
||||
}
|
||||
```
|
||||
|
||||
### 4. Run the test
|
||||
|
||||
Run the test and make sure it's green.
|
||||
|
||||
[Previous](formatter_test.html) [Top](writing_tests_for_plugins.html) [Next](folding_test.html)
|
||||
|
||||
|
@ -19,7 +19,7 @@ and cover its code with functional tests.
|
||||
* [Completion Test](completion_test.html)
|
||||
* [Annotator Test](annotator_test.html)
|
||||
* [Formatter Test](formatter_test.html)
|
||||
* [Rename Test](TODO)
|
||||
* [Rename Test](rename_test.html)
|
||||
* [Folding Test](TODO)
|
||||
* [Find Usages Test](TODO)
|
||||
* [Commenter Test](TODO)
|
||||
|
Loading…
x
Reference in New Issue
Block a user