Quickfix and intention tests refactoring: refer to intention action by class when checking that it's not available (instead of listing all available actions)
This commit is contained in:
@@ -1,2 +1,3 @@
|
|||||||
// "Specify type explicitly" "false"
|
// "class org.jetbrains.jet.plugin.intentions.SpecifyTypeExplicitlyAction" "false"
|
||||||
|
|
||||||
val x = "<caret>"
|
val x = "<caret>"
|
||||||
@@ -1,2 +1,3 @@
|
|||||||
// "Specify type explicitly" "false"
|
// "class org.jetbrains.jet.plugin.intentions.SpecifyTypeExplicitlyAction" "false"
|
||||||
|
|
||||||
val <caret>x = BadType()
|
val <caret>x = BadType()
|
||||||
@@ -1,2 +1,3 @@
|
|||||||
// "Specify type explicitly" "false"
|
// "class org.jetbrains.jet.plugin.intentions.SpecifyTypeExplicitlyAction" "false"
|
||||||
|
|
||||||
val x = "<caret>"
|
val x = "<caret>"
|
||||||
@@ -1,2 +1,3 @@
|
|||||||
// "Specify type explicitly" "false"
|
// "class org.jetbrains.jet.plugin.intentions.SpecifyTypeExplicitlyAction" "false"
|
||||||
|
|
||||||
val <caret>x = BadType()
|
val <caret>x = BadType()
|
||||||
@@ -1,5 +1,4 @@
|
|||||||
// "Add '<*, *>'" "false"
|
// "class org.jetbrains.jet.plugin.quickfix.AddStarProjectionsFix" "false"
|
||||||
// "Add '<*>'" "false"
|
|
||||||
// ERROR: 2 type arguments expected
|
// ERROR: 2 type arguments expected
|
||||||
public fun foo(a: Any) {
|
public fun foo(a: Any) {
|
||||||
a is Map<Int>
|
a is Map<Int>
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
// "Add '<*, *>'" "false"
|
// "class org.jetbrains.jet.plugin.quickfix.AddStarProjectionsFix" "false"
|
||||||
// "Add '<*>'" "false"
|
|
||||||
// ERROR: 2 type arguments expected
|
// ERROR: 2 type arguments expected
|
||||||
public fun foo(a: Any) {
|
public fun foo(a: Any) {
|
||||||
a is <caret>Map<Int>
|
a is <caret>Map<Int>
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
// "Add '<*, *>'" "false"
|
// "class org.jetbrains.jet.plugin.quickfix.AddStarProjectionsFix" "false"
|
||||||
// ERROR: Type argument expected
|
// ERROR: Type argument expected
|
||||||
class C2<T>
|
class C2<T>
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
// "Add '<*>'" "false"
|
// "class org.jetbrains.jet.plugin.quickfix.AddStarProjectionsFix" "false"
|
||||||
// "Add '<*, *>'" "false"
|
|
||||||
class C
|
class C
|
||||||
|
|
||||||
fun test() {
|
fun test() {
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
// "Add '<*, *>'" "false"
|
// "class org.jetbrains.jet.plugin.quickfix.AddStarProjectionsFix" "false"
|
||||||
// ERROR: Type argument expected
|
// ERROR: Type argument expected
|
||||||
class C2<T>
|
class C2<T>
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
// "Add '<*>'" "false"
|
// "class org.jetbrains.jet.plugin.quickfix.AddStarProjectionsFix" "false"
|
||||||
// "Add '<*, *>'" "false"
|
|
||||||
class C
|
class C
|
||||||
|
|
||||||
fun test() {
|
fun test() {
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
// "Add '<*, *>'" "false"
|
// "class org.jetbrains.jet.plugin.quickfix.AddStarProjectionsFix" "false"
|
||||||
// "Add '<*>'" "false"
|
|
||||||
// ERROR: 2 type arguments expected
|
// ERROR: 2 type arguments expected
|
||||||
public fun foo(a: Any) {
|
public fun foo(a: Any) {
|
||||||
when (a) {
|
when (a) {
|
||||||
|
|||||||
@@ -1,12 +1,5 @@
|
|||||||
// "Add '<*, *>'" "false"
|
// "class org.jetbrains.jet.plugin.quickfix.AddStarProjectionsFix" "false"
|
||||||
// "Add '<*>'" "false"
|
|
||||||
// ERROR: 2 type arguments expected
|
// ERROR: 2 type arguments expected
|
||||||
// ACTION: Disable 'Eliminate Argument of 'when''
|
|
||||||
// ACTION: Disable 'Replace 'when' with 'if''
|
|
||||||
// ACTION: Edit intention settings
|
|
||||||
// ACTION: Edit intention settings
|
|
||||||
// ACTION: Eliminate argument of 'when'
|
|
||||||
// ACTION: Replace 'when' with 'if'
|
|
||||||
public fun foo(a: Any) {
|
public fun foo(a: Any) {
|
||||||
when (a) {
|
when (a) {
|
||||||
is <caret>Map<Int> -> {}
|
is <caret>Map<Int> -> {}
|
||||||
|
|||||||
+1
-2
@@ -1,5 +1,4 @@
|
|||||||
// "Import Class" "false"
|
// "class com.intellij.codeInsight.daemon.impl.quickfix.ImportClassFixBase" "false"
|
||||||
|
|
||||||
// KT-3165 Weird stack overflow in IDE
|
// KT-3165 Weird stack overflow in IDE
|
||||||
// ERROR: Unresolved reference: Bar
|
// ERROR: Unresolved reference: Bar
|
||||||
// ERROR: Unresolved reference: SomeImpossibleName
|
// ERROR: Unresolved reference: SomeImpossibleName
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
// "Import Class" "false"
|
// "class com.intellij.codeInsight.daemon.impl.quickfix.ImportClassFixBase" "false"
|
||||||
// ERROR: Unresolved reference: some[12]
|
// ERROR: Unresolved reference: some[12]
|
||||||
// ERROR: No get method providing array access
|
// ERROR: No get method providing array access
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
// "Import Class" "false"
|
// "class com.intellij.codeInsight.daemon.impl.quickfix.ImportClassFixBase" "false"
|
||||||
|
|
||||||
package Teting
|
package Teting
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
// "Import Class" "false"
|
// "class com.intellij.codeInsight.daemon.impl.quickfix.ImportClassFixBase" "false"
|
||||||
|
|
||||||
// KT-3165 Weird stack overflow in IDE
|
// KT-3165 Weird stack overflow in IDE
|
||||||
// ERROR: Unresolved reference: Bar
|
// ERROR: Unresolved reference: Bar
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
// "Import Class" "false"
|
// "class com.intellij.codeInsight.daemon.impl.quickfix.ImportClassFixBase" "false"
|
||||||
// ERROR: Unresolved reference: TTT
|
// ERROR: Unresolved reference: TTT
|
||||||
|
|
||||||
class {
|
class {
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
// "Import Class" "false"
|
// "class com.intellij.codeInsight.daemon.impl.quickfix.ImportClassFixBase" "false"
|
||||||
// ERROR: Unresolved reference: TTTTT
|
// ERROR: Unresolved reference: TTTTT
|
||||||
|
|
||||||
fun () {
|
fun () {
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
// "Import Class" "false"
|
// "class com.intellij.codeInsight.daemon.impl.quickfix.ImportClassFixBase" "false"
|
||||||
// ERROR: Unresolved reference: TTT
|
// ERROR: Unresolved reference: TTT
|
||||||
|
|
||||||
object {
|
object {
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
// "Import Class" "false"
|
// "class com.intellij.codeInsight.daemon.impl.quickfix.ImportClassFixBase" "false"
|
||||||
// ERROR: Function 'f' must have a body
|
// ERROR: Function 'f' must have a body
|
||||||
// ERROR: Unresolved reference: TTT
|
// ERROR: Unresolved reference: TTT
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
// "Import Class" "false"
|
// "class com.intellij.codeInsight.daemon.impl.quickfix.ImportClassFixBase" "false"
|
||||||
// ERROR: Unresolved reference: TTT
|
// ERROR: Unresolved reference: TTT
|
||||||
|
|
||||||
val : Int
|
val : Int
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
// "Import Class" "false"
|
// "class com.intellij.codeInsight.daemon.impl.quickfix.ImportClassFixBase" "false"
|
||||||
// ERROR: Unresolved reference: someFun
|
// ERROR: Unresolved reference: someFun
|
||||||
// ERROR: Unresolved reference: test
|
// ERROR: Unresolved reference: test
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
// "Import Class" "false"
|
// "class com.intellij.codeInsight.daemon.impl.quickfix.ImportClassFixBase" "false"
|
||||||
// ERROR: Unresolved reference: some[12]
|
// ERROR: Unresolved reference: some[12]
|
||||||
// ERROR: No get method providing array access
|
// ERROR: No get method providing array access
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
// "Import" "false"
|
// "class com.intellij.codeInsight.daemon.impl.quickfix.ImportClassFixBase" "false"
|
||||||
// ERROR: Unresolved reference: externalFun
|
// ERROR: Unresolved reference: externalFun
|
||||||
|
|
||||||
package testing
|
package testing
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
// "Import" "false"
|
// "class com.intellij.codeInsight.daemon.impl.quickfix.ImportClassFixBase" "false"
|
||||||
// ERROR: Unresolved reference: externalFun
|
// ERROR: Unresolved reference: externalFun
|
||||||
|
|
||||||
package testing
|
package testing
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
// "Import Class" "false"
|
// "class com.intellij.codeInsight.daemon.impl.quickfix.ImportClassFixBase" "false"
|
||||||
// ERROR: Unresolved reference: PrivateClass
|
// ERROR: Unresolved reference: PrivateClass
|
||||||
|
|
||||||
fun test() {
|
fun test() {
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
// "Import" "false"
|
// "class com.intellij.codeInsight.daemon.impl.quickfix.ImportClassFixBase" "false"
|
||||||
// ERROR: Unresolved reference: PrivateClass
|
// ERROR: Unresolved reference: PrivateClass
|
||||||
|
|
||||||
fun test() {
|
fun test() {
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
// "Import" "false"
|
// "class com.intellij.codeInsight.daemon.impl.quickfix.ImportClassFixBase" "false"
|
||||||
// ERROR: Unresolved reference: SomeTest
|
// ERROR: Unresolved reference: SomeTest
|
||||||
|
|
||||||
package testing
|
package testing
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
// "Import" "false"
|
// "class com.intellij.codeInsight.daemon.impl.quickfix.ImportClassFixBase" "false"
|
||||||
// ERROR: Unresolved reference: SomeTest
|
// ERROR: Unresolved reference: SomeTest
|
||||||
|
|
||||||
package testing
|
package testing
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
// "Import" "false"
|
// "class com.intellij.codeInsight.daemon.impl.quickfix.ImportClassFixBase" "false"
|
||||||
// ERROR: Unresolved reference: SomeTest
|
// ERROR: Unresolved reference: SomeTest
|
||||||
|
|
||||||
package testing
|
package testing
|
||||||
|
|||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
// "Import" "false"
|
// "class com.intellij.codeInsight.daemon.impl.quickfix.ImportClassFixBase" "false"
|
||||||
// ERROR: Unresolved reference: SomeTest
|
// ERROR: Unresolved reference: SomeTest
|
||||||
|
|
||||||
package testing
|
package testing
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
// "Import" "false"
|
// "class com.intellij.codeInsight.daemon.impl.quickfix.ImportClassFixBase" "false"
|
||||||
// ERROR: Unresolved reference: SomeTest
|
// ERROR: Unresolved reference: SomeTest
|
||||||
|
|
||||||
package testing
|
package testing
|
||||||
|
|||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
// "Import" "false"
|
// "class com.intellij.codeInsight.daemon.impl.quickfix.ImportClassFixBase" "false"
|
||||||
// ERROR: Unresolved reference: SomeTest
|
// ERROR: Unresolved reference: SomeTest
|
||||||
|
|
||||||
package testing
|
package testing
|
||||||
|
|||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
// "Import" "false"
|
// "class com.intellij.codeInsight.daemon.impl.quickfix.ImportClassFixBase" "false"
|
||||||
// ERROR: Unresolved reference: SomeTest
|
// ERROR: Unresolved reference: SomeTest
|
||||||
|
|
||||||
package testing
|
package testing
|
||||||
|
|||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
// "Import" "false"
|
// "class com.intellij.codeInsight.daemon.impl.quickfix.ImportClassFixBase" "false"
|
||||||
// ERROR: Unresolved reference: SomeTest
|
// ERROR: Unresolved reference: SomeTest
|
||||||
|
|
||||||
package testing
|
package testing
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
// "Import" "false"
|
// "class com.intellij.codeInsight.daemon.impl.quickfix.ImportClassFixBase" "false"
|
||||||
// ERROR: Unresolved reference: FooPackage
|
// ERROR: Unresolved reference: FooPackage
|
||||||
|
|
||||||
package packageClass
|
package packageClass
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
// "Add parameter to function 'component1'" "false"
|
// "class org.jetbrains.jet.plugin.quickfix.AddFunctionParametersFix" "false"
|
||||||
//ERROR: Too many arguments for internal final fun component1(): jet.Int defined in Data
|
//ERROR: Too many arguments for internal final fun component1(): jet.Int defined in Data
|
||||||
|
|
||||||
data class Data(val i: Int) {}
|
data class Data(val i: Int) {}
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
// "Add parameter to function 'equals'" "false"
|
// "class org.jetbrains.jet.plugin.quickfix.AddFunctionParametersFix" "false"
|
||||||
// ERROR: Too many arguments for public fun jet.Any?.equals(other: jet.Any?): jet.Boolean defined in jet
|
// ERROR: Too many arguments for public fun jet.Any?.equals(other: jet.Any?): jet.Boolean defined in jet
|
||||||
|
|
||||||
fun f(d: Any) {
|
fun f(d: Any) {
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
// "Add parameter to function 'equals'" "false"
|
// "class org.jetbrains.jet.plugin.quickfix.AddFunctionParametersFix" "false"
|
||||||
// ERROR: Too many arguments for public open fun equals(p0: jet.Any?): jet.Boolean defined in java.lang.Object
|
// ERROR: Too many arguments for public open fun equals(p0: jet.Any?): jet.Boolean defined in java.lang.Object
|
||||||
|
|
||||||
fun f(d: java.lang.Object) {
|
fun f(d: java.lang.Object) {
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
// "Add parameter to function 'component1'" "false"
|
// "class org.jetbrains.jet.plugin.quickfix.AddFunctionParametersFix" "false"
|
||||||
//ERROR: Too many arguments for internal final fun component1(): jet.Int defined in Data
|
//ERROR: Too many arguments for internal final fun component1(): jet.Int defined in Data
|
||||||
|
|
||||||
data class Data(val i: Int) {}
|
data class Data(val i: Int) {}
|
||||||
|
|||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
// "Remove parameter 'other'" "false"
|
// "class org.jetbrains.jet.plugin.quickfix.RemoveFunctionParametersFix" "false"
|
||||||
// ERROR: No value passed for parameter other
|
// ERROR: No value passed for parameter other
|
||||||
|
|
||||||
fun f(d: Boolean) {
|
fun f(d: Boolean) {
|
||||||
|
|||||||
@@ -1,6 +0,0 @@
|
|||||||
// "Replace sure() calls by !! in project" "false"
|
|
||||||
// ERROR: Unresolved reference: sure
|
|
||||||
|
|
||||||
fun test() {
|
|
||||||
sure()
|
|
||||||
}
|
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
// "Replace sure() calls by !! in project" "false"
|
// "class org.jetbrains.jet.plugin.quickfix.MigrateSureInProjectFix" "false"
|
||||||
// ERROR: Unresolved reference: sure
|
// ERROR: Unresolved reference: sure
|
||||||
|
|
||||||
fun test() {
|
fun test() {
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
// "Make E open" "false"
|
// "class org.jetbrains.jet.plugin.quickfix.AddOpenModifierToClassDeclarationFix" "false"
|
||||||
// ERROR: This type is final, so it cannot be inherited from
|
// ERROR: This type is final, so it cannot be inherited from
|
||||||
// ERROR: Cannot access '<init>': it is 'private' in 'E'
|
// ERROR: Cannot access '<init>': it is 'private' in 'E'
|
||||||
enum class E {}
|
enum class E {}
|
||||||
|
|||||||
@@ -1,3 +1,3 @@
|
|||||||
// "Make E open" "false"
|
// "class org.jetbrains.jet.plugin.quickfix.AddOpenModifierToClassDeclarationFix" "false"
|
||||||
enum class E {}
|
enum class E {}
|
||||||
class A<T : E<caret>> {}
|
class A<T : E<caret>> {}
|
||||||
|
|||||||
+1
-1
@@ -1,3 +1,3 @@
|
|||||||
// "Make String open" "false"
|
// "class org.jetbrains.jet.plugin.quickfix.AddOpenModifierToClassDeclarationFix" "false"
|
||||||
// ERROR: This type is final, so it cannot be inherited from
|
// ERROR: This type is final, so it cannot be inherited from
|
||||||
class A : String<caret>() {}
|
class A : String<caret>() {}
|
||||||
|
|||||||
+1
-1
@@ -1,2 +1,2 @@
|
|||||||
// "Make String open" "false"
|
// "class org.jetbrains.jet.plugin.quickfix.AddOpenModifierToClassDeclarationFix" "false"
|
||||||
class A<T : String<caret>> {}
|
class A<T : String<caret>> {}
|
||||||
|
|||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
// "Make JavaClass open" "false"
|
// "class org.jetbrains.jet.plugin.quickfix.AddOpenModifierToClassDeclarationFix" "false"
|
||||||
// ERROR: This type is final, so it cannot be inherited from
|
// ERROR: This type is final, so it cannot be inherited from
|
||||||
import testPackage.*
|
import testPackage.*
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
// "Make JavaClass open" "false"
|
// "class org.jetbrains.jet.plugin.quickfix.AddOpenModifierToClassDeclarationFix" "false"
|
||||||
import testPackage.*
|
import testPackage.*
|
||||||
|
|
||||||
class foo<T : JavaClass>() {}
|
class foo<T : JavaClass>() {}
|
||||||
|
|||||||
@@ -1,3 +1,3 @@
|
|||||||
// "Make 'String' an annotation class" "false"
|
// "class org.jetbrains.jet.plugin.quickfix.MakeClassAnAnnotationClassFix" "false"
|
||||||
// ERROR: 'String' is not an annotation class
|
// ERROR: 'String' is not an annotation class
|
||||||
[String<caret>] class foo {}
|
[String<caret>] class foo {}
|
||||||
|
|||||||
@@ -1,8 +1,5 @@
|
|||||||
// "Make Object.notify open" "false"
|
// "class org.jetbrains.jet.plugin.quickfix.MakeOverriddenMemberOpenFix" "false"
|
||||||
// ERROR: 'notify' in 'Object' is final and cannot be overridden
|
// ERROR: 'notify' in 'Object' is final and cannot be overridden
|
||||||
// ACTION: Convert to extension
|
|
||||||
// ACTION: Disable 'Convert to extension'
|
|
||||||
// ACTION: Edit intention settings
|
|
||||||
class A : Object() {
|
class A : Object() {
|
||||||
override<caret> fun notify() {}
|
override<caret> fun notify() {}
|
||||||
}
|
}
|
||||||
+1
-4
@@ -1,10 +1,7 @@
|
|||||||
// "Make 'ordinal' in E and X open" "false"
|
// "class org.jetbrains.jet.plugin.quickfix.MakeOverriddenMemberOpenFix" "false"
|
||||||
// ERROR: This type is final, so it cannot be inherited from
|
// ERROR: This type is final, so it cannot be inherited from
|
||||||
// ERROR: Cannot access '<init>': it is 'private' in 'E'
|
// ERROR: Cannot access '<init>': it is 'private' in 'E'
|
||||||
// ERROR: 'ordinal' in 'E' is final and cannot be overridden
|
// ERROR: 'ordinal' in 'E' is final and cannot be overridden
|
||||||
// ACTION: Convert to extension
|
|
||||||
// ACTION: Disable 'Convert to extension'
|
|
||||||
// ACTION: Edit intention settings
|
|
||||||
enum class E {}
|
enum class E {}
|
||||||
trait X {
|
trait X {
|
||||||
final fun ordinal() : Int = 42
|
final fun ordinal() : Int = 42
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
// "Rename parameter to match overridden method" "false"
|
// "class org.jetbrains.jet.plugin.quickfix.RenameParameterToMatchOverriddenMethodFix" "false"
|
||||||
|
|
||||||
abstract class A {
|
abstract class A {
|
||||||
abstract fun foo(arg : Int) : Int;
|
abstract fun foo(arg : Int) : Int;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,10 +1,5 @@
|
|||||||
// "Change function signature to 'override fun f(a: Int)'" "false"
|
// "class org.jetbrains.jet.plugin.quickfix.ChangeMemberFunctionSignatureFix" "false"
|
||||||
// ERROR: 'f' overrides nothing
|
// ERROR: 'f' overrides nothing
|
||||||
// ACTION: Add 'open fun f(a: String)' to 'A'
|
|
||||||
// ACTION: Remove 'override' modifier
|
|
||||||
// ACTION: Convert to extension
|
|
||||||
// ACTION: Disable 'Convert to extension'
|
|
||||||
// ACTION: Edit intention settings
|
|
||||||
open class A {
|
open class A {
|
||||||
open fun foo() {}
|
open fun foo() {}
|
||||||
fun f(a: Int) {}
|
fun f(a: Int) {}
|
||||||
|
|||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
// "Change 'A.x' type to 'String'" "false"
|
// "class org.jetbrains.jet.plugin.quickfix.ChangeVariableTypeFix" "false"
|
||||||
// ERROR: <html>Var-property type is 'jet.String', which is not a type of overridden<br/><b>internal</b> <b>abstract</b> <b>var</b> x: jet.Int <i>defined in</i> A</html>
|
// ERROR: <html>Var-property type is 'jet.String', which is not a type of overridden<br/><b>internal</b> <b>abstract</b> <b>var</b> x: jet.Int <i>defined in</i> A</html>
|
||||||
trait A {
|
trait A {
|
||||||
var x: Int
|
var x: Int
|
||||||
|
|||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
// "Change 'C.x' type to 'String'" "false"
|
// "class org.jetbrains.jet.plugin.quickfix.ChangeVariableTypeFix" "false"
|
||||||
// ERROR: <html>Var-property type is 'jet.Int', which is not a type of overridden<br/><b>internal</b> <b>abstract</b> <b>var</b> x: jet.String <i>defined in</i> A</html>
|
// ERROR: <html>Var-property type is 'jet.Int', which is not a type of overridden<br/><b>internal</b> <b>abstract</b> <b>var</b> x: jet.String <i>defined in</i> A</html>
|
||||||
trait A {
|
trait A {
|
||||||
var x: String
|
var x: String
|
||||||
|
|||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
// "Change 'A.foo' function return type to 'Long'" "false"
|
// "class org.jetbrains.jet.plugin.quickfix.ChangeFunctionReturnTypeFix" "false"
|
||||||
// ERROR: <html>Return type is 'jet.Long', which is not a subtype of overridden<br/><b>internal</b> <b>abstract</b> <b>fun</b> foo(): jet.Int <i>defined in</i> A</html>
|
// ERROR: <html>Return type is 'jet.Long', which is not a subtype of overridden<br/><b>internal</b> <b>abstract</b> <b>fun</b> foo(): jet.Int <i>defined in</i> A</html>
|
||||||
trait A {
|
trait A {
|
||||||
fun foo(): Int
|
fun foo(): Int
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
// "Change to constructor invocation" "false"
|
// "class org.jetbrains.jet.plugin.quickfix.ChangeToConstructorInvocationFix" "false"
|
||||||
// ERROR: This type has a constructor, and thus must be initialized here
|
// ERROR: This type has a constructor, and thus must be initialized here
|
||||||
open class A(x : Int) {}
|
open class A(x : Int) {}
|
||||||
class B : A<caret> {}
|
class B : A<caret> {}
|
||||||
|
|||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
// "Suppress 'REDUNDANT_NULLABLE' for fun foo" "false"
|
// "class com.intellij.codeInspection.SuppressIntentionAction" "false"
|
||||||
|
|
||||||
[suppress("REDUNDANT_NULLABLE")]
|
[suppress("REDUNDANT_NULLABLE")]
|
||||||
fun foo(): String?<caret>? = null
|
fun foo(): String?<caret>? = null
|
||||||
+1
-2
@@ -1,5 +1,4 @@
|
|||||||
// "Suppress 'UNNECESSARY_NOT_NULL_ASSERTION' for statement " "false"
|
// "class com.intellij.codeInspection.SuppressIntentionAction" "false"
|
||||||
// ACTION: Remove unnecessary non-null assertion (!!)
|
|
||||||
|
|
||||||
[suppress("FOO"<caret>!!)]
|
[suppress("FOO"<caret>!!)]
|
||||||
fun foo() {}
|
fun foo() {}
|
||||||
@@ -1,5 +1,4 @@
|
|||||||
// "Suppress 'UNNECESSARY_NOT_NULL_ASSERTION' for statement " "false"
|
// "class com.intellij.codeInspection.SuppressIntentionAction" "false"
|
||||||
// ACTION: Remove unnecessary non-null assertion (!!)
|
|
||||||
|
|
||||||
open class Base(s: String)
|
open class Base(s: String)
|
||||||
class Child: Base(""<caret>!!)
|
class Child: Base(""<caret>!!)
|
||||||
@@ -1,4 +1,3 @@
|
|||||||
// "Suppress 'UNNECESSARY_NOT_NULL_ASSERTION' for statement " "false"
|
// "class com.intellij.codeInspection.SuppressIntentionAction" "false"
|
||||||
// ACTION: Remove unnecessary non-null assertion (!!)
|
|
||||||
|
|
||||||
fun foo(s: String = ""<caret>!!) {}
|
fun foo(s: String = ""<caret>!!) {}
|
||||||
@@ -1,4 +1,3 @@
|
|||||||
// "Suppress 'UNNECESSARY_NOT_NULL_ASSERTION' for statement " "false"
|
// "class com.intellij.codeInspection.SuppressIntentionAction" "false"
|
||||||
// ACTION: Remove unnecessary non-null assertion (!!)
|
|
||||||
|
|
||||||
fun foo() = ""<caret>!!
|
fun foo() = ""<caret>!!
|
||||||
+1
-5
@@ -1,8 +1,4 @@
|
|||||||
// "Suppress 'UNNECESSARY_NOT_NULL_ASSERTION' for statement " "false"
|
// "class com.intellij.codeInspection.SuppressIntentionAction" "false"
|
||||||
// ACTION: Disable 'Split Property Declaration'
|
|
||||||
// ACTION: Edit intention settings
|
|
||||||
// ACTION: Remove unnecessary non-null assertion (!!)
|
|
||||||
// ACTION: Split property declaration
|
|
||||||
|
|
||||||
fun foo() {
|
fun foo() {
|
||||||
val bar = ""<caret>!!
|
val bar = ""<caret>!!
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
// "Suppress 'REDUNDANT_NULLABLE' for statement " "false"
|
// "class com.intellij.codeInspection.SuppressIntentionAction" "false"
|
||||||
// ACTION: Remove redundant '?'
|
|
||||||
|
|
||||||
fun foo(s: String?<caret>?) {}
|
fun foo(s: String?<caret>?) {}
|
||||||
+1
-2
@@ -1,5 +1,4 @@
|
|||||||
// "Suppress 'REDUNDANT_NULLABLE' for statement " "false"
|
// "class com.intellij.codeInspection.SuppressIntentionAction" "false"
|
||||||
// ACTION: Remove redundant '?'
|
|
||||||
|
|
||||||
fun foo() {
|
fun foo() {
|
||||||
any {
|
any {
|
||||||
|
|||||||
+1
-2
@@ -1,4 +1,3 @@
|
|||||||
// "Suppress 'UNNECESSARY_NOT_NULL_ASSERTION' for statement " "false"
|
// "class com.intellij.codeInspection.SuppressIntentionAction" "false"
|
||||||
// ACTION: Remove unnecessary non-null assertion (!!)
|
|
||||||
|
|
||||||
val foo = ""<caret>!!
|
val foo = ""<caret>!!
|
||||||
@@ -1,5 +1,4 @@
|
|||||||
// "Suppress 'UNNECESSARY_NOT_NULL_ASSERTION' for object <anonymous>" "false"
|
// "class com.intellij.codeInspection.SuppressIntentionAction" "false"
|
||||||
// ACTION: Remove unnecessary non-null assertion (!!)
|
|
||||||
|
|
||||||
fun foo() {
|
fun foo() {
|
||||||
object : Base(""<caret>!!) {
|
object : Base(""<caret>!!) {
|
||||||
|
|||||||
+1
-5
@@ -1,8 +1,4 @@
|
|||||||
// "Suppress 'UNNECESSARY_NOT_NULL_ASSERTION' for object <anonymous>" "false"
|
// "class com.intellij.codeInspection.SuppressIntentionAction" "false"
|
||||||
// ACTION: Disable 'Split Property Declaration'
|
|
||||||
// ACTION: Edit intention settings
|
|
||||||
// ACTION: Remove unnecessary non-null assertion (!!)
|
|
||||||
// ACTION: Split property declaration
|
|
||||||
|
|
||||||
fun foo() {
|
fun foo() {
|
||||||
val a = object : Base(""<caret>!!) {
|
val a = object : Base(""<caret>!!) {
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
// "Suppress 'REDUNDANT_NULLABLE' for statement " "false"
|
// "class com.intellij.codeInspection.SuppressIntentionAction" "false"
|
||||||
// ACTION: Remove redundant '?'
|
|
||||||
|
|
||||||
open class Base<T>
|
open class Base<T>
|
||||||
class Child: Base<String?<caret>?>()
|
class Child: Base<String?<caret>?>()
|
||||||
@@ -1,6 +1,5 @@
|
|||||||
// "Cast expression 'a: A' to 'B'" "false"
|
// "class org.jetbrains.jet.plugin.quickfix.CastExpressionFix" "false"
|
||||||
// ERROR: <html>Type mismatch.<table><tr><td>Required:</td><td>B</td></tr><tr><td>Found:</td><td>A</td></tr></table></html>
|
// ERROR: <html>Type mismatch.<table><tr><td>Required:</td><td>B</td></tr><tr><td>Found:</td><td>A</td></tr></table></html>
|
||||||
// ACTION: Change 'foo' function return type to 'A'
|
|
||||||
open class A
|
open class A
|
||||||
class B : A()
|
class B : A()
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
// "Change parameter 'y' type of function 'foo' to 'Int'" "false"
|
// "class org.jetbrains.jet.plugin.quickfix.ChangeParameterTypeFix" "false"
|
||||||
// ERROR: <html>Type mismatch.<table><tr><td>Required:</td><td>jet.Int</td></tr><tr><td>Found:</td><td>jet.String</td></tr></table></html>
|
// ERROR: <html>Type mismatch.<table><tr><td>Required:</td><td>jet.Int</td></tr><tr><td>Found:</td><td>jet.String</td></tr></table></html>
|
||||||
fun foo(y: Int = 0, z: (Int) -> String = {""}) {
|
fun foo(y: Int = 0, z: (Int) -> String = {""}) {
|
||||||
foo(""<caret>: Int)
|
foo(""<caret>: Int)
|
||||||
|
|||||||
+1
-4
@@ -1,6 +1,3 @@
|
|||||||
// "Change function 'foo' return type to 'String'" "false"
|
// "class org.jetbrains.jet.plugin.quickfix.ChangeFunctionReturnTypeFix" "false"
|
||||||
// ERROR: <html>Type mismatch.<table><tr><td>Required:</td><td>jet.Int</td></tr><tr><td>Found:</td><td>jet.String</td></tr></table></html>
|
// ERROR: <html>Type mismatch.<table><tr><td>Required:</td><td>jet.Int</td></tr><tr><td>Found:</td><td>jet.String</td></tr></table></html>
|
||||||
// ACTION: Disable 'Replace 'if' with 'when''
|
|
||||||
// ACTION: Edit intention settings
|
|
||||||
// ACTION: Replace 'if' with 'when'
|
|
||||||
fun foo(): Int = if (true) ""<caret>: Int else 4
|
fun foo(): Int = if (true) ""<caret>: Int else 4
|
||||||
@@ -1,14 +1,8 @@
|
|||||||
// "Move else branch to the end" "false"
|
// "class org.jetbrains.jet.plugin.quickfix.MoveWhenElseBranchFix" "false"
|
||||||
// ERROR: 'else' entry must be the last one in a when-expression
|
// ERROR: 'else' entry must be the last one in a when-expression
|
||||||
// ERROR: 'else' entry must be the last one in a when-expression
|
// ERROR: 'else' entry must be the last one in a when-expression
|
||||||
// WARNING: Unreachable code
|
// WARNING: Unreachable code
|
||||||
// WARNING: Unreachable code
|
// WARNING: Unreachable code
|
||||||
// ACTION: Disable 'Eliminate Argument of 'when''
|
|
||||||
// ACTION: Disable 'Replace 'when' with 'if''
|
|
||||||
// ACTION: Edit intention settings
|
|
||||||
// ACTION: Edit intention settings
|
|
||||||
// ACTION: Eliminate argument of 'when'
|
|
||||||
// ACTION: Replace 'when' with 'if'
|
|
||||||
package foo
|
package foo
|
||||||
|
|
||||||
fun foo() {
|
fun foo() {
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ import com.intellij.openapi.projectRoots.Sdk;
|
|||||||
import com.intellij.openapi.startup.StartupManager;
|
import com.intellij.openapi.startup.StartupManager;
|
||||||
import com.intellij.openapi.util.Pair;
|
import com.intellij.openapi.util.Pair;
|
||||||
import com.intellij.psi.PsiElement;
|
import com.intellij.psi.PsiElement;
|
||||||
|
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.lang.psi.JetFile;
|
import org.jetbrains.jet.lang.psi.JetFile;
|
||||||
@@ -53,7 +54,7 @@ public abstract class AbstractQuickFixTest extends LightQuickFixTestCase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
doSingleTest(getTestName(false) + ".kt");
|
doSingleTest(getTestName(false) + ".kt");
|
||||||
checkAvailableActionsAreExpected();
|
checkForUnexpectedActions();
|
||||||
checkForUnexpectedErrors();
|
checkForUnexpectedErrors();
|
||||||
}
|
}
|
||||||
finally {
|
finally {
|
||||||
@@ -63,12 +64,26 @@ public abstract class AbstractQuickFixTest extends LightQuickFixTestCase {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void checkAvailableActionsAreExpected() {
|
private void checkForUnexpectedActions() throws ClassNotFoundException {
|
||||||
List<IntentionAction> actions = getAvailableActions();
|
|
||||||
Pair<String, Boolean> pair = parseActionHintImpl(getFile(), getEditor().getDocument().getText());
|
Pair<String, Boolean> pair = parseActionHintImpl(getFile(), getEditor().getDocument().getText());
|
||||||
if (!pair.getSecond()) {
|
if (!pair.second) {
|
||||||
// Action shouldn't be found. Check that other actions are expected and thus tested action isn't there under another name.
|
List<IntentionAction> actions = getAvailableActions();
|
||||||
QuickFixActionsUtils.checkAvailableActionsAreExpected((JetFile) getFile(), actions);
|
|
||||||
|
String prefix = "class ";
|
||||||
|
if (pair.first.startsWith(prefix)) {
|
||||||
|
String className = pair.first.substring(prefix.length());
|
||||||
|
Class<?> aClass = Class.forName(className);
|
||||||
|
assert IntentionAction.class.isAssignableFrom(aClass) : className + " should be inheritor of IntentionAction";
|
||||||
|
for (IntentionAction action : actions) {
|
||||||
|
if (aClass.isAssignableFrom(action.getClass())) {
|
||||||
|
Assert.fail("Unexpected intention action " + action.getClass() + " found");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
// Action shouldn't be found. Check that other actions are expected and thus tested action isn't there under another name.
|
||||||
|
QuickFixActionsUtils.checkAvailableActionsAreExpected((JetFile) getFile(), actions);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user