Fix test data of QuickFixTest
This commit is contained in:
+2
@@ -1,5 +1,7 @@
|
|||||||
// "Change 'A.x' type to '(Int) -> Int'" "false"
|
// "Change 'A.x' type to '(Int) -> Int'" "false"
|
||||||
// ACTION: Change 'C.x' type to '(String) -> Int'
|
// ACTION: Change 'C.x' type to '(String) -> Int'
|
||||||
|
// ACTION: Disable inspection
|
||||||
|
// ACTION: Edit inspection profile setting
|
||||||
// ERROR: <html>Return type is '(kotlin.Int) → kotlin.Int', which is not a subtype of overridden<br/><b>internal</b> <b>abstract</b> <b>val</b> x: (kotlin.String) → kotlin.Int <i>defined in</i> A</html>
|
// ERROR: <html>Return type is '(kotlin.Int) → kotlin.Int', which is not a subtype of overridden<br/><b>internal</b> <b>abstract</b> <b>val</b> x: (kotlin.String) → kotlin.Int <i>defined in</i> A</html>
|
||||||
trait A {
|
trait A {
|
||||||
val x: (String) -> Int
|
val x: (String) -> Int
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
// "class com.intellij.codeInspection.SuppressIntentionAction" "false"
|
// "class com.intellij.codeInspection.SuppressIntentionAction" "false"
|
||||||
|
// ACTION: Suppress 'INTEGER_OVERFLOW' for fun foo
|
||||||
|
|
||||||
[Ann(Integer.MAX_VALUE<caret> + 1)]
|
[Ann(Integer.MAX_VALUE<caret> + 1)]
|
||||||
fun foo() {}
|
fun foo() {}
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
// "class com.intellij.codeInspection.SuppressIntentionAction" "false"
|
// "class com.intellij.codeInspection.SuppressIntentionAction" "false"
|
||||||
|
// ACTION: Suppress 'UNNECESSARY_NOT_NULL_ASSERTION' for class Child
|
||||||
|
|
||||||
open class Base(s: String)
|
open class Base(s: String)
|
||||||
class Child: Base(""<caret>!!)
|
class Child: Base(""<caret>!!)
|
||||||
@@ -1,3 +1,5 @@
|
|||||||
// "class com.intellij.codeInspection.SuppressIntentionAction" "false"
|
// "class com.intellij.codeInspection.SuppressIntentionAction" "false"
|
||||||
|
// ACTION: Suppress 'UNNECESSARY_NOT_NULL_ASSERTION' for fun foo
|
||||||
|
// ACTION: Suppress 'UNNECESSARY_NOT_NULL_ASSERTION' for parameter s
|
||||||
|
|
||||||
fun foo(s: String = ""<caret>!!) {}
|
fun foo(s: String = ""<caret>!!) {}
|
||||||
@@ -1,3 +1,4 @@
|
|||||||
// "class com.intellij.codeInspection.SuppressIntentionAction" "false"
|
// "class com.intellij.codeInspection.SuppressIntentionAction" "false"
|
||||||
|
// ACTION: Suppress 'UNNECESSARY_NOT_NULL_ASSERTION' for fun foo
|
||||||
|
|
||||||
fun foo() = ""<caret>!!
|
fun foo() = ""<caret>!!
|
||||||
+2
@@ -1,4 +1,6 @@
|
|||||||
// "class com.intellij.codeInspection.SuppressIntentionAction" "false"
|
// "class com.intellij.codeInspection.SuppressIntentionAction" "false"
|
||||||
|
// ACTION: Suppress 'UNNECESSARY_NOT_NULL_ASSERTION' for fun foo
|
||||||
|
// ACTION: Suppress 'UNNECESSARY_NOT_NULL_ASSERTION' for val bar
|
||||||
|
|
||||||
fun foo() {
|
fun foo() {
|
||||||
val bar = ""<caret>!!
|
val bar = ""<caret>!!
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
// "class com.intellij.codeInspection.SuppressIntentionAction" "false"
|
// "class com.intellij.codeInspection.SuppressIntentionAction" "false"
|
||||||
|
// ACTION: Suppress 'REDUNDANT_NULLABLE' for fun foo
|
||||||
|
// ACTION: Suppress 'REDUNDANT_NULLABLE' for parameter s
|
||||||
|
|
||||||
fun foo(s: String?<caret>?) {}
|
fun foo(s: String?<caret>?) {}
|
||||||
+2
@@ -1,4 +1,6 @@
|
|||||||
// "class com.intellij.codeInspection.SuppressIntentionAction" "false"
|
// "class com.intellij.codeInspection.SuppressIntentionAction" "false"
|
||||||
|
// ACTION: Suppress 'REDUNDANT_NULLABLE' for fun foo
|
||||||
|
// ACTION: Suppress 'REDUNDANT_NULLABLE' for parameter x
|
||||||
|
|
||||||
fun foo() {
|
fun foo() {
|
||||||
any {
|
any {
|
||||||
|
|||||||
+1
@@ -1,3 +1,4 @@
|
|||||||
// "class com.intellij.codeInspection.SuppressIntentionAction" "false"
|
// "class com.intellij.codeInspection.SuppressIntentionAction" "false"
|
||||||
|
// ACTION: Suppress 'UNNECESSARY_NOT_NULL_ASSERTION' for val foo
|
||||||
|
|
||||||
val foo = ""<caret>!!
|
val foo = ""<caret>!!
|
||||||
@@ -1,4 +1,5 @@
|
|||||||
// "class com.intellij.codeInspection.SuppressIntentionAction" "false"
|
// "class com.intellij.codeInspection.SuppressIntentionAction" "false"
|
||||||
|
// ACTION: Suppress 'UNNECESSARY_NOT_NULL_ASSERTION' for fun foo
|
||||||
|
|
||||||
fun foo() {
|
fun foo() {
|
||||||
object : Base(""<caret>!!) {
|
object : Base(""<caret>!!) {
|
||||||
|
|||||||
+2
@@ -1,4 +1,6 @@
|
|||||||
// "class com.intellij.codeInspection.SuppressIntentionAction" "false"
|
// "class com.intellij.codeInspection.SuppressIntentionAction" "false"
|
||||||
|
// ACTION: Suppress 'UNNECESSARY_NOT_NULL_ASSERTION' for fun foo
|
||||||
|
// ACTION: Suppress 'UNNECESSARY_NOT_NULL_ASSERTION' for val a
|
||||||
|
|
||||||
fun foo() {
|
fun foo() {
|
||||||
val a = object : Base(""<caret>!!) {
|
val a = object : Base(""<caret>!!) {
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
// "class com.intellij.codeInspection.SuppressIntentionAction" "false"
|
// "class com.intellij.codeInspection.SuppressIntentionAction" "false"
|
||||||
|
// ACTION: Suppress 'REDUNDANT_NULLABLE' for class Child
|
||||||
|
|
||||||
open class Base<T>
|
open class Base<T>
|
||||||
class Child: Base<String?<caret>?>()
|
class Child: Base<String?<caret>?>()
|
||||||
@@ -4,6 +4,10 @@
|
|||||||
// ACTION: Make 'foo' abstract
|
// ACTION: Make 'foo' abstract
|
||||||
// ACTION: Convert to extension
|
// ACTION: Convert to extension
|
||||||
// ACTION: Disable 'Convert to extension'
|
// ACTION: Disable 'Convert to extension'
|
||||||
|
// ACTION: Disable inspection
|
||||||
|
// ACTION: Disable inspection
|
||||||
|
// ACTION: Edit inspection profile setting
|
||||||
|
// ACTION: Edit inspection profile setting
|
||||||
// ACTION: Edit intention settings
|
// ACTION: Edit intention settings
|
||||||
|
|
||||||
package a
|
package a
|
||||||
|
|||||||
+2
@@ -1,5 +1,7 @@
|
|||||||
// "Change 'B.x' type to '(String) -> [ERROR : Ay]'" "false"
|
// "Change 'B.x' type to '(String) -> [ERROR : Ay]'" "false"
|
||||||
// ACTION: Change 'A.x' type to '(Int) -> Int'
|
// ACTION: Change 'A.x' type to '(Int) -> Int'
|
||||||
|
// ACTION: Disable inspection
|
||||||
|
// ACTION: Edit inspection profile setting
|
||||||
// ERROR: <html>Return type is '(kotlin.Int) → kotlin.Int', which is not a subtype of overridden<br/><b>internal</b> <b>abstract</b> <b>val</b> x: (kotlin.String) → [ERROR : Ay] <i>defined in</i> A</html>
|
// ERROR: <html>Return type is '(kotlin.Int) → kotlin.Int', which is not a subtype of overridden<br/><b>internal</b> <b>abstract</b> <b>val</b> x: (kotlin.String) → [ERROR : Ay] <i>defined in</i> A</html>
|
||||||
// ERROR: Unresolved reference: Ay
|
// ERROR: Unresolved reference: Ay
|
||||||
trait A {
|
trait A {
|
||||||
|
|||||||
@@ -31,12 +31,15 @@ import com.intellij.psi.PsiElement;
|
|||||||
import junit.framework.Assert;
|
import junit.framework.Assert;
|
||||||
import org.apache.commons.lang.SystemUtils;
|
import org.apache.commons.lang.SystemUtils;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
import org.jetbrains.jet.InTextDirectivesUtils;
|
||||||
import org.jetbrains.jet.lang.psi.JetFile;
|
import org.jetbrains.jet.lang.psi.JetFile;
|
||||||
import org.jetbrains.jet.plugin.PluginTestCaseBase;
|
import org.jetbrains.jet.plugin.PluginTestCaseBase;
|
||||||
import org.jetbrains.jet.test.TestMetadata;
|
import org.jetbrains.jet.test.TestMetadata;
|
||||||
import org.jetbrains.jet.testing.ConfigLibraryUtil;
|
import org.jetbrains.jet.testing.ConfigLibraryUtil;
|
||||||
|
|
||||||
|
import java.util.HashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
public abstract class AbstractQuickFixTest extends LightQuickFixTestCase {
|
public abstract class AbstractQuickFixTest extends LightQuickFixTestCase {
|
||||||
@Override
|
@Override
|
||||||
@@ -65,7 +68,8 @@ public abstract class AbstractQuickFixTest extends LightQuickFixTestCase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void checkForUnexpectedActions() throws ClassNotFoundException {
|
private void checkForUnexpectedActions() throws ClassNotFoundException {
|
||||||
Pair<String, Boolean> pair = parseActionHintImpl(getFile(), getEditor().getDocument().getText());
|
String text = getEditor().getDocument().getText();
|
||||||
|
Pair<String, Boolean> pair = parseActionHintImpl(getFile(), text);
|
||||||
if (!pair.second) {
|
if (!pair.second) {
|
||||||
List<IntentionAction> actions = getAvailableActions();
|
List<IntentionAction> actions = getAvailableActions();
|
||||||
|
|
||||||
@@ -74,8 +78,11 @@ public abstract class AbstractQuickFixTest extends LightQuickFixTestCase {
|
|||||||
String className = pair.first.substring(prefix.length());
|
String className = pair.first.substring(prefix.length());
|
||||||
Class<?> aClass = Class.forName(className);
|
Class<?> aClass = Class.forName(className);
|
||||||
assert IntentionAction.class.isAssignableFrom(aClass) : className + " should be inheritor of IntentionAction";
|
assert IntentionAction.class.isAssignableFrom(aClass) : className + " should be inheritor of IntentionAction";
|
||||||
|
|
||||||
|
Set<String> validActions = new HashSet<String>(InTextDirectivesUtils.findLinesWithPrefixesRemoved(text, "// ACTION:"));
|
||||||
|
|
||||||
for (IntentionAction action : actions) {
|
for (IntentionAction action : actions) {
|
||||||
if (aClass.isAssignableFrom(action.getClass())) {
|
if (aClass.isAssignableFrom(action.getClass()) && !validActions.contains(action.getText())) {
|
||||||
Assert.fail("Unexpected intention action " + action.getClass() + " found");
|
Assert.fail("Unexpected intention action " + action.getClass() + " found");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user