Rewrite AbstractQuickFixTest based on light fixture test case

Don't reconfigure runtime before every test. For consistency,
mark tests that require the runtime with directives instead of relying
on test file names.
This commit is contained in:
Dmitry Jemerov
2017-03-23 19:47:39 +01:00
parent 34ad19a912
commit e2f75463d7
127 changed files with 204 additions and 227 deletions
@@ -49,6 +49,8 @@ abstract class KotlinLightCodeInsightFixtureTestCase : KotlinLightCodeInsightFix
protected val module: Module get() = myFixture.module
protected open val captureExceptions = true
override fun setUp() {
super.setUp()
(StartupManager.getInstance(project) as StartupManagerImpl).runPostStartupActivities()
@@ -61,12 +63,14 @@ abstract class KotlinLightCodeInsightFixtureTestCase : KotlinLightCodeInsightFix
invalidateLibraryCache(project)
LoggedErrorProcessor.setNewInstance(object : LoggedErrorProcessor() {
override fun processError(message: String?, t: Throwable?, details: Array<out String>?, logger: Logger) {
exceptions.addIfNotNull(t)
super.processError(message, t, details, logger)
}
})
if (captureExceptions) {
LoggedErrorProcessor.setNewInstance(object : LoggedErrorProcessor() {
override fun processError(message: String?, t: Throwable?, details: Array<out String>?, logger: Logger) {
exceptions.addIfNotNull(t)
super.processError(message, t, details, logger)
}
})
}
}
override fun tearDown() {
@@ -116,6 +120,9 @@ abstract class KotlinLightCodeInsightFixtureTestCase : KotlinLightCodeInsightFix
else if (InTextDirectivesUtils.isDirectiveDefined(fileText, "RUNTIME_WITH_KOTLIN_TEST")) {
return KotlinWithJdkAndRuntimeLightProjectDescriptor.INSTANCE_WITH_KOTLIN_TEST
}
else if (InTextDirectivesUtils.isDirectiveDefined(fileText, "RUNTIME_WITH_FULL_JDK")) {
return KotlinWithJdkAndRuntimeLightProjectDescriptor.INSTANCE_FULL_JDK
}
else if (InTextDirectivesUtils.isDirectiveDefined(fileText, "RUNTIME") ||
InTextDirectivesUtils.isDirectiveDefined(fileText, "WITH_RUNTIME")) {
return KotlinWithJdkAndRuntimeLightProjectDescriptor.INSTANCE
@@ -1,4 +1,5 @@
// "Add 'kotlin.Any' as upper bound for E" "true"
// WITH_RUNTIME
import kotlin.reflect.KClass
@@ -1,4 +1,5 @@
// "Add 'kotlin.Any' as upper bound for E" "true"
// WITH_RUNTIME
import kotlin.reflect.KClass
@@ -2,6 +2,7 @@
// ACTION: Make internal
// ACTION: Make private
// ACTION: Make protected
// WITH_RUNTIME
class A {
<caret>val n: Int by lazy { 0 }
}
@@ -1,4 +1,5 @@
// "Import" "true"
// JS
package test
@@ -1,4 +1,5 @@
// "Import" "true"
// JS
package test
@@ -1,4 +1,5 @@
// "Import" "true"
// RUNTIME_WITH_KOTLIN_TEST
package test
@@ -1,4 +1,5 @@
// "Import" "true"
// RUNTIME_WITH_KOTLIN_TEST
package test
@@ -1,4 +1,5 @@
// "Import" "true"
// JS
package some
fun testFun() {
@@ -1,4 +1,5 @@
// "Import" "true"
// JS
package some
import jquery.jq
@@ -1,4 +1,5 @@
// "Import" "true"
// WITH_RUNTIME
package some
fun testFun() {
@@ -1,4 +1,5 @@
// "Import" "true"
// WITH_RUNTIME
package some
import kotlin.system.measureNanoTime
@@ -3,7 +3,6 @@
// ACTION: Create local variable 'A'
// ACTION: Create parameter 'A'
// ACTION: Create property 'A'
// ACTION: Import
// ACTION: Rename reference
// ERROR: Unresolved reference: A
package p
@@ -4,7 +4,6 @@
// ACTION: Create parameter 'A'
// ACTION: Create property 'A'
// ACTION: Rename reference
// ACTION: Import
// ERROR: Unresolved reference: A
package p
@@ -3,7 +3,6 @@
// ACTION: Create local variable 'A'
// ACTION: Create parameter 'A'
// ACTION: Create property 'A'
// ACTION: Import
// ACTION: Rename reference
// ERROR: Unresolved reference: A
package p
@@ -3,7 +3,6 @@
// ACTION: Create local variable 'A'
// ACTION: Create parameter 'A'
// ACTION: Create property 'A'
// ACTION: Import
// ACTION: Rename reference
// ERROR: Unresolved reference: A
package p
@@ -3,7 +3,6 @@
// ACTION: Create local variable 'A'
// ACTION: Create parameter 'A'
// ACTION: Create property 'A'
// ACTION: Import
// ACTION: Rename reference
// ERROR: Unresolved reference: A
package p
@@ -1,4 +1,5 @@
// "Replace with 'newFun()'" "true"
// WITH_RUNTIME
@Deprecated("", ReplaceWith("newFun()"))
fun oldFun(p: Int): Int {
@@ -1,4 +1,5 @@
// "Replace with 'newFun()'" "true"
// WITH_RUNTIME
@Deprecated("", ReplaceWith("newFun()"))
fun oldFun(p: Int): Int {
@@ -1,4 +1,5 @@
// "Replace with 'newFun()'" "true"
// WITH_RUNTIME
@Deprecated("", ReplaceWith("newFun()"))
fun oldFun(p: Int?): Int {
@@ -1,4 +1,5 @@
// "Replace with 'newFun()'" "true"
// WITH_RUNTIME
@Deprecated("", ReplaceWith("newFun()"))
fun oldFun(p: Int?): Int {
@@ -1,4 +1,5 @@
// "Replace with 'newFun(p2)'" "true"
// WITH_RUNTIME
@Deprecated("", ReplaceWith("newFun(p2)"))
fun oldFun(p1: Int, p2: Int): Boolean {
@@ -1,4 +1,5 @@
// "Replace with 'newFun(p2)'" "true"
// WITH_RUNTIME
@Deprecated("", ReplaceWith("newFun(p2)"))
fun oldFun(p1: Int, p2: Int): Boolean {
@@ -1,4 +1,5 @@
// "Replace with 'newFun()'" "true"
// WITH_RUNTIME
class C {
@Deprecated("", ReplaceWith("newFun()"))
@@ -1,4 +1,5 @@
// "Replace with 'newFun()'" "true"
// WITH_RUNTIME
class C {
@Deprecated("", ReplaceWith("newFun()"))
@@ -1,4 +1,5 @@
// "Replace with 'newFun()'" "true"
// WITH_RUNTIME
package ppp
fun bar(): Int = 0
@@ -1,4 +1,5 @@
// "Replace with 'newFun()'" "true"
// WITH_RUNTIME
package ppp
fun bar(): Int = 0
@@ -1,4 +1,5 @@
// "Replace with 'newFun(p, p)'" "true"
// WITH_RUNTIME
@Deprecated("", ReplaceWith("newFun(p, p)"))
fun oldFun(p: Int): Int {
@@ -1,4 +1,5 @@
// "Replace with 'newFun(p, p)'" "true"
// WITH_RUNTIME
@Deprecated("", ReplaceWith("newFun(p, p)"))
fun oldFun(p: Int): Int {
@@ -1,4 +1,5 @@
// "Replace with 'newFun(p, p)'" "true"
// WITH_RUNTIME
import java.util.*
@@ -1,4 +1,5 @@
// "Replace with 'newFun(p, p)'" "true"
// WITH_RUNTIME
import java.util.*
@@ -1,4 +1,5 @@
// "Replace with 'newFun(p, p)'" "true"
// WITH_RUNTIME
@Deprecated("", ReplaceWith("newFun(p, p)"))
fun oldFun(p: Int?): Int {
@@ -1,4 +1,5 @@
// "Replace with 'newFun(p, p)'" "true"
// WITH_RUNTIME
@Deprecated("", ReplaceWith("newFun(p, p)"))
fun oldFun(p: Int?): Int {
@@ -1,4 +1,5 @@
// "Replace usages of 'myJavaClass(): Class<T>' in whole project" "true"
// WITH_RUNTIME
@Deprecated("", ReplaceWith("T::class.java"))
inline fun <reified T: Any> myJavaClass(): Class<T> = T::class.java
@@ -1,6 +1,7 @@
import java.util.Random
// "Replace usages of 'myJavaClass(): Class<T>' in whole project" "true"
// WITH_RUNTIME
@Deprecated("", ReplaceWith("T::class.java"))
inline fun <reified T: Any> myJavaClass(): Class<T> = T::class.java
@@ -1,4 +1,5 @@
// "Replace with 'newFun(this, s)'" "true"
// WITH_RUNTIME
interface I {
@Deprecated("", ReplaceWith("newFun(this, s)"))
@@ -1,4 +1,5 @@
// "Replace with 'newFun(this, s)'" "true"
// WITH_RUNTIME
interface I {
@Deprecated("", ReplaceWith("newFun(this, s)"))
@@ -1,4 +1,5 @@
// "Replace with 'newFun()'" "true"
// WITH_RUNTIME
@Deprecated("", ReplaceWith("newFun()"))
fun Int.oldFun(): Int = this
@@ -1,4 +1,5 @@
// "Replace with 'newFun()'" "true"
// WITH_RUNTIME
@Deprecated("", ReplaceWith("newFun()"))
fun Int.oldFun(): Int = this
@@ -1,4 +1,5 @@
// "Replace with 'c.newFun(this)'" "true"
// WITH_RUNTIME
class X {
@Deprecated("", ReplaceWith("c.newFun(this)"))
@@ -1,4 +1,5 @@
// "Replace with 'c.newFun(this)'" "true"
// WITH_RUNTIME
class X {
@Deprecated("", ReplaceWith("c.newFun(this)"))
@@ -1,4 +1,5 @@
// "Replace with 's.filter { it != c }'" "true"
// WITH_RUNTIME
class X {
@Deprecated("", ReplaceWith("s.filter { it != c }"))
@@ -1,4 +1,5 @@
// "Replace with 's.filter { it != c }'" "true"
// WITH_RUNTIME
class X {
@Deprecated("", ReplaceWith("s.filter { it != c }"))
@@ -1,4 +1,5 @@
// "Replace with 'c1.newFun(this, c2)'" "true"
// WITH_RUNTIME
class X {
@Deprecated("", ReplaceWith("c1.newFun(this, c2)"))
@@ -1,4 +1,5 @@
// "Replace with 'c1.newFun(this, c2)'" "true"
// WITH_RUNTIME
class X {
@Deprecated("", ReplaceWith("c1.newFun(this, c2)"))
@@ -1,4 +1,5 @@
// "Replace with 'c1.newFun(this, c2)'" "true"
// WITH_RUNTIME
class X(val c: Char) {
@Deprecated("", ReplaceWith("c1.newFun(this, c2)"))
@@ -1,4 +1,5 @@
// "Replace with 'c1.newFun(this, c2)'" "true"
// WITH_RUNTIME
class X(val c: Char) {
@Deprecated("", ReplaceWith("c1.newFun(this, c2)"))
@@ -1,4 +1,5 @@
// "Replace with 's.newFun(this)'" "true"
// WITH_RUNTIME
class X {
@Deprecated("", ReplaceWith("s.newFun(this)"))
@@ -1,4 +1,5 @@
// "Replace with 's.newFun(this)'" "true"
// WITH_RUNTIME
class X {
@Deprecated("", ReplaceWith("s.newFun(this)"))
@@ -1,4 +1,5 @@
// "Replace with 'newFun(*elements)'" "true"
// WITH_RUNTIME
@Deprecated("", ReplaceWith("newFun(*elements)"))
fun <T> oldFun(vararg elements: T) {
@@ -1,4 +1,5 @@
// "Replace with 'newFun(*elements)'" "true"
// WITH_RUNTIME
@Deprecated("", ReplaceWith("newFun(*elements)"))
fun <T> oldFun(vararg elements: T) {
@@ -1,4 +1,5 @@
// "Replace with 'newFun(p)'" "true"
// WITH_RUNTIME
@Deprecated("", ReplaceWith("newFun(p)"))
fun oldFun(p: List<String>) {
@@ -1,4 +1,5 @@
// "Replace with 'newFun(p)'" "true"
// WITH_RUNTIME
@Deprecated("", ReplaceWith("newFun(p)"))
fun oldFun(p: List<String>) {
@@ -1,4 +1,5 @@
// "Replace with 'newFun(*elements)'" "true"
// WITH_RUNTIME
@Deprecated("", ReplaceWith("newFun(*elements)"))
fun <T> oldFun(vararg elements: T) {
@@ -1,4 +1,5 @@
// "Replace with 'newFun(*elements)'" "true"
// WITH_RUNTIME
@Deprecated("", ReplaceWith("newFun(*elements)"))
fun <T> oldFun(vararg elements: T) {
@@ -1,4 +1,5 @@
// "Replace with 'newFun(*elements)'" "true"
// WITH_RUNTIME
@Deprecated("", ReplaceWith("newFun(*elements)"))
fun <T> oldFun(vararg elements: T) {
@@ -1,4 +1,5 @@
// "Replace with 'newFun(*elements)'" "true"
// WITH_RUNTIME
@Deprecated("", ReplaceWith("newFun(*elements)"))
fun <T> oldFun(vararg elements: T) {
@@ -1,4 +1,5 @@
// "Replace with 'newFun(*p, x = null)'" "true"
// WITH_RUNTIME
@Deprecated("", ReplaceWith("newFun(*p, x = null)"))
fun oldFun(vararg p: Int){
@@ -1,4 +1,5 @@
// "Replace with 'newFun(*p, x = null)'" "true"
// WITH_RUNTIME
@Deprecated("", ReplaceWith("newFun(*p, x = null)"))
fun oldFun(vararg p: Int){
@@ -1,4 +1,5 @@
// "Replace with 'newFun(*p, 1)'" "true"
// WITH_RUNTIME
@Deprecated("", ReplaceWith("newFun(*p, 1)"))
fun oldFun(vararg p: Int){
@@ -1,4 +1,5 @@
// "Replace with 'newFun(*p, 1)'" "true"
// WITH_RUNTIME
@Deprecated("", ReplaceWith("newFun(*p, 1)"))
fun oldFun(vararg p: Int){
@@ -1,4 +1,5 @@
// "Replace with 'newFun(*p, *list.toIntArray())'" "true"
// WITH_RUNTIME
@Deprecated("", ReplaceWith("newFun(*p, *list.toIntArray())"))
fun oldFun(list: List<Int>, vararg p: Int){
@@ -1,4 +1,5 @@
// "Replace with 'newFun(*p, *list.toIntArray())'" "true"
// WITH_RUNTIME
@Deprecated("", ReplaceWith("newFun(*p, *list.toIntArray())"))
fun oldFun(list: List<Int>, vararg p: Int){
@@ -1,4 +1,5 @@
// "Replace with 'newFun(p)'" "true"
// WITH_RUNTIME
@Deprecated("", ReplaceWith("newFun(p)"))
fun oldFun(vararg p: Boolean){
@@ -1,4 +1,5 @@
// "Replace with 'newFun(p)'" "true"
// WITH_RUNTIME
@Deprecated("", ReplaceWith("newFun(p)"))
fun oldFun(vararg p: Boolean){
@@ -1,4 +1,5 @@
// "Replace with 'newFun(p)'" "true"
// WITH_RUNTIME
@Deprecated("", ReplaceWith("newFun(p)"))
fun oldFun(vararg p: Byte){
@@ -1,4 +1,5 @@
// "Replace with 'newFun(p)'" "true"
// WITH_RUNTIME
@Deprecated("", ReplaceWith("newFun(p)"))
fun oldFun(vararg p: Byte){
@@ -1,4 +1,5 @@
// "Replace with 'newFun(*c)'" "true"
// WITH_RUNTIME
@Deprecated("", ReplaceWith("newFun(*c)"))
fun oldFun(vararg c: Char){}
@@ -1,4 +1,5 @@
// "Replace with 'newFun(*c)'" "true"
// WITH_RUNTIME
@Deprecated("", ReplaceWith("newFun(*c)"))
fun oldFun(vararg c: Char){}
@@ -1,4 +1,5 @@
// "Replace with 'newFun(*c)'" "true"
// WITH_RUNTIME
@Deprecated("", ReplaceWith("newFun(*c)"))
fun oldFun(vararg c: Char){}
@@ -1,4 +1,5 @@
// "Replace with 'newFun(*c)'" "true"
// WITH_RUNTIME
@Deprecated("", ReplaceWith("newFun(*c)"))
fun oldFun(vararg c: Char){}
@@ -1,4 +1,5 @@
// "Replace with 'newFun(p)'" "true"
// WITH_RUNTIME
fun foo(vararg s: String) = s.joinToString()
@@ -1,4 +1,5 @@
// "Replace with 'newFun(p)'" "true"
// WITH_RUNTIME
fun foo(vararg s: String) = s.joinToString()
@@ -1,4 +1,5 @@
// "Replace with 'newFun(p)'" "true"
// WITH_RUNTIME
@Deprecated("", ReplaceWith("newFun(p)"))
fun oldFun(vararg p: Double){
@@ -1,4 +1,5 @@
// "Replace with 'newFun(p)'" "true"
// WITH_RUNTIME
@Deprecated("", ReplaceWith("newFun(p)"))
fun oldFun(vararg p: Double){
@@ -1,4 +1,5 @@
// "Replace with 'newFun(p)'" "true"
// WITH_RUNTIME
@Deprecated("", ReplaceWith("newFun(p)"))
fun oldFun(vararg p: Float){
@@ -1,4 +1,5 @@
// "Replace with 'newFun(p)'" "true"
// WITH_RUNTIME
@Deprecated("", ReplaceWith("newFun(p)"))
fun oldFun(vararg p: Float){
@@ -1,4 +1,5 @@
// "Replace with 'newFun(p)'" "true"
// WITH_RUNTIME
@Deprecated("", ReplaceWith("newFun(p)"))
fun oldFun(vararg p: Long){
@@ -1,4 +1,5 @@
// "Replace with 'newFun(p)'" "true"
// WITH_RUNTIME
@Deprecated("", ReplaceWith("newFun(p)"))
fun oldFun(vararg p: Long){
@@ -1,4 +1,5 @@
// "Replace with 'newFun(p)'" "true"
// WITH_RUNTIME
@Deprecated("", ReplaceWith("newFun(p)"))
fun oldFun(vararg p: Int){
@@ -1,4 +1,5 @@
// "Replace with 'newFun(p)'" "true"
// WITH_RUNTIME
@Deprecated("", ReplaceWith("newFun(p)"))
fun oldFun(vararg p: Int){
@@ -1,4 +1,5 @@
// "Replace with 'newFun(*p, 1)'" "true"
// WITH_RUNTIME
@Deprecated("", ReplaceWith("newFun(*p, 1)"))
fun oldFun(vararg p: Int){
@@ -1,4 +1,5 @@
// "Replace with 'newFun(*p, 1)'" "true"
// WITH_RUNTIME
@Deprecated("", ReplaceWith("newFun(*p, 1)"))
fun oldFun(vararg p: Int){
@@ -1,4 +1,5 @@
// "Replace with 'newFun(*elements)'" "true"
// WITH_RUNTIME
@Deprecated("", ReplaceWith("newFun(*elements)"))
fun oldFun(vararg elements: java.io.File?) {
@@ -1,4 +1,5 @@
// "Replace with 'newFun(*elements)'" "true"
// WITH_RUNTIME
@Deprecated("", ReplaceWith("newFun(*elements)"))
fun oldFun(vararg elements: java.io.File?) {
@@ -1,4 +1,5 @@
// "Replace with 'newFun(p)'" "true"
// WITH_RUNTIME
@Deprecated("", ReplaceWith("newFun(p)"))
fun oldFun(vararg p: Short){
@@ -1,4 +1,5 @@
// "Replace with 'newFun(p)'" "true"
// WITH_RUNTIME
@Deprecated("", ReplaceWith("newFun(p)"))
fun oldFun(vararg p: Short){
@@ -1,4 +1,5 @@
// "Replace with 'newFun(p1, *p2)'" "true"
// WITH_RUNTIME
@Deprecated("", ReplaceWith("newFun(p1, *p2)"))
fun oldFun(p1: String, vararg p2: Int){
@@ -1,4 +1,5 @@
// "Replace with 'newFun(p1, *p2)'" "true"
// WITH_RUNTIME
@Deprecated("", ReplaceWith("newFun(p1, *p2)"))
fun oldFun(p1: String, vararg p2: Int){
@@ -1,4 +1,5 @@
// "Replace with 'newFun(p1, *p2)'" "true"
// WITH_RUNTIME
@Deprecated("", ReplaceWith("newFun(p1, *p2)"))
fun oldFun(p1: String, vararg p2: Int){
@@ -1,4 +1,5 @@
// "Replace with 'newFun(p1, *p2)'" "true"
// WITH_RUNTIME
@Deprecated("", ReplaceWith("newFun(p1, *p2)"))
fun oldFun(p1: String, vararg p2: Int){
@@ -1,4 +1,5 @@
// "Replace with 'newFun(p1, *p2)'" "true"
// WITH_RUNTIME
@Deprecated("", ReplaceWith("newFun(p1, *p2)"))
fun oldFun(p1: String, vararg p2: Int){
@@ -1,4 +1,5 @@
// "Replace with 'newFun(p1, *p2)'" "true"
// WITH_RUNTIME
@Deprecated("", ReplaceWith("newFun(p1, *p2)"))
fun oldFun(p1: String, vararg p2: Int){
@@ -1,4 +1,5 @@
// "Replace with 'newFun(p1, p2)'" "true"
// WITH_RUNTIME
@Deprecated("", ReplaceWith("newFun(p1, p2)"))
fun oldFun(p1: String, vararg p2: Int) {
@@ -1,4 +1,5 @@
// "Replace with 'newFun(p1, p2)'" "true"
// WITH_RUNTIME
@Deprecated("", ReplaceWith("newFun(p1, p2)"))
fun oldFun(p1: String, vararg p2: Int) {
@@ -1,4 +1,5 @@
// "Replace with 'newFun(p1, *p2)'" "true"
// WITH_RUNTIME
@Deprecated("", ReplaceWith("newFun(p1, *p2)"))
fun oldFun(p1: String, p2: IntArray) {
@@ -1,4 +1,5 @@
// "Replace with 'newFun(p1, *p2)'" "true"
// WITH_RUNTIME
@Deprecated("", ReplaceWith("newFun(p1, *p2)"))
fun oldFun(p1: String, p2: IntArray) {
@@ -2,6 +2,7 @@
// ACTION: Make internal
// ACTION: Make private
// ACTION: Make protected
// WITH_RUNTIME
class A {
<caret>val n: Int by lazy { 0 }
}
@@ -1,4 +1,5 @@
// "Fix with 'asDynamic'" "true"
// JS
class A
@@ -1,4 +1,5 @@
// "Fix with 'asDynamic'" "true"
// JS
class A

Some files were not shown because too many files have changed in this diff Show More