Add ability to test for expected intention text
If a testData file contains `// INTENTION_TEXT: ...`, the tested intention's description must match `...`.
This commit is contained in:
@@ -170,6 +170,12 @@ public abstract class AbstractCodeTransformationTest extends LightCodeInsightTes
|
|||||||
"isAvailable() for " + intentionAction.getClass() + " should return " + isApplicableExpected,
|
"isAvailable() for " + intentionAction.getClass() + " should return " + isApplicableExpected,
|
||||||
isApplicableExpected == intentionAction.isAvailable(getProject(), getEditor(), getFile()));
|
isApplicableExpected == intentionAction.isAvailable(getProject(), getEditor(), getFile()));
|
||||||
|
|
||||||
|
String intentionTextString = InTextDirectivesUtils.findStringWithPrefixes(fileText, "// INTENTION_TEXT: ");
|
||||||
|
|
||||||
|
if (intentionTextString != null) {
|
||||||
|
assertEquals("Intention text mismatch.", intentionTextString, intentionAction.getText());
|
||||||
|
}
|
||||||
|
|
||||||
String shouldFailString = InTextDirectivesUtils.findStringWithPrefixes(fileText, "// SHOULD_FAIL_WITH: ");
|
String shouldFailString = InTextDirectivesUtils.findStringWithPrefixes(fileText, "// SHOULD_FAIL_WITH: ");
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|||||||
Reference in New Issue
Block a user