Fix assertEquals usage in kotlin code after adding statics to scope.
This commit is contained in:
@@ -17,6 +17,7 @@
|
|||||||
package org.jetbrains.kotlin.serialization.jvm
|
package org.jetbrains.kotlin.serialization.jvm
|
||||||
|
|
||||||
import com.intellij.testFramework.UsefulTestCase
|
import com.intellij.testFramework.UsefulTestCase
|
||||||
|
import com.intellij.testFramework.UsefulTestCase.assertEquals
|
||||||
import org.jetbrains.kotlin.load.kotlin.JvmNameResolver
|
import org.jetbrains.kotlin.load.kotlin.JvmNameResolver
|
||||||
import org.jetbrains.kotlin.name.ClassId
|
import org.jetbrains.kotlin.name.ClassId
|
||||||
import org.jetbrains.kotlin.name.FqName
|
import org.jetbrains.kotlin.name.FqName
|
||||||
@@ -25,7 +26,6 @@ import org.jetbrains.kotlin.serialization.jvm.JvmProtoBuf.StringTableTypes.Recor
|
|||||||
import org.jetbrains.kotlin.serialization.jvm.JvmProtoBuf.StringTableTypes.Record.Operation.INTERNAL_TO_CLASS_ID
|
import org.jetbrains.kotlin.serialization.jvm.JvmProtoBuf.StringTableTypes.Record.Operation.INTERNAL_TO_CLASS_ID
|
||||||
import org.jetbrains.kotlin.serialization.jvm.JvmProtoBuf.StringTableTypes.Record.Operation.NONE
|
import org.jetbrains.kotlin.serialization.jvm.JvmProtoBuf.StringTableTypes.Record.Operation.NONE
|
||||||
import java.util.*
|
import java.util.*
|
||||||
import kotlin.test.assertEquals
|
|
||||||
|
|
||||||
class JvmNameResolverTest : UsefulTestCase() {
|
class JvmNameResolverTest : UsefulTestCase() {
|
||||||
private class Context {
|
private class Context {
|
||||||
@@ -83,7 +83,7 @@ class JvmNameResolverTest : UsefulTestCase() {
|
|||||||
|
|
||||||
fun testPredefined() {
|
fun testPredefined() {
|
||||||
for ((index, predefined) in JvmNameResolver.PREDEFINED_STRINGS.withIndex()) {
|
for ((index, predefined) in JvmNameResolver.PREDEFINED_STRINGS.withIndex()) {
|
||||||
assertEquals(predefined, str("ignored", predefinedIndex = index), "Predefined string failed: $predefined (index $index)")
|
assertEquals("Predefined string failed: $predefined (index $index)", predefined, str("ignored", predefinedIndex = index))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+4
-3
@@ -35,6 +35,7 @@ import com.intellij.refactoring.introduceParameter.Util
|
|||||||
import com.intellij.refactoring.util.occurrences.ExpressionOccurrenceManager
|
import com.intellij.refactoring.util.occurrences.ExpressionOccurrenceManager
|
||||||
import com.intellij.testFramework.fixtures.JavaCodeInsightTestFixture
|
import com.intellij.testFramework.fixtures.JavaCodeInsightTestFixture
|
||||||
import com.intellij.testFramework.fixtures.LightCodeInsightFixtureTestCase
|
import com.intellij.testFramework.fixtures.LightCodeInsightFixtureTestCase
|
||||||
|
import com.intellij.testFramework.fixtures.LightCodeInsightFixtureTestCase.assertEquals
|
||||||
import org.jetbrains.kotlin.idea.refactoring.JetRefactoringUtil
|
import org.jetbrains.kotlin.idea.refactoring.JetRefactoringUtil
|
||||||
import org.jetbrains.kotlin.idea.refactoring.introduce.extractFunction.EXTRACT_FUNCTION
|
import org.jetbrains.kotlin.idea.refactoring.introduce.extractFunction.EXTRACT_FUNCTION
|
||||||
import org.jetbrains.kotlin.idea.refactoring.introduce.extractFunction.ExtractKotlinFunctionHandler
|
import org.jetbrains.kotlin.idea.refactoring.introduce.extractFunction.ExtractKotlinFunctionHandler
|
||||||
@@ -55,7 +56,7 @@ import org.jetbrains.kotlin.test.JetTestUtils
|
|||||||
import org.jetbrains.kotlin.test.util.findElementByCommentPrefix
|
import org.jetbrains.kotlin.test.util.findElementByCommentPrefix
|
||||||
import org.jetbrains.kotlin.utils.emptyOrSingletonList
|
import org.jetbrains.kotlin.utils.emptyOrSingletonList
|
||||||
import java.io.File
|
import java.io.File
|
||||||
import java.util.Collections
|
import java.util.*
|
||||||
import kotlin.test.assertEquals
|
import kotlin.test.assertEquals
|
||||||
|
|
||||||
public abstract class AbstractJetExtractionTest() : JetLightCodeInsightFixtureTestCase() {
|
public abstract class AbstractJetExtractionTest() : JetLightCodeInsightFixtureTestCase() {
|
||||||
@@ -286,8 +287,8 @@ public abstract class AbstractJetExtractionTest() : JetLightCodeInsightFixtureTe
|
|||||||
if (actualReturnTypes.size() != 1 || expectedReturnTypes.isNotEmpty()) {
|
if (actualReturnTypes.size() != 1 || expectedReturnTypes.isNotEmpty()) {
|
||||||
assertEquals(expectedReturnTypes, actualReturnTypes, "Expected return types mismatch.")
|
assertEquals(expectedReturnTypes, actualReturnTypes, "Expected return types mismatch.")
|
||||||
}
|
}
|
||||||
assertEquals(expectedDescriptors, actualDescriptors, "Expected descriptors mismatch.")
|
assertEquals("Expected descriptors mismatch.", expectedDescriptors, actualDescriptors)
|
||||||
assertEquals(expectedTypes, actualTypes, "Expected types mismatch.")
|
assertEquals("Expected types mismatch.", expectedTypes, actualTypes)
|
||||||
|
|
||||||
val newDescriptor = if (descriptor.name == "") {
|
val newDescriptor = if (descriptor.name == "") {
|
||||||
descriptor.copy(suggestedNames = Collections.singletonList("__dummyTestFun__"))
|
descriptor.copy(suggestedNames = Collections.singletonList("__dummyTestFun__"))
|
||||||
|
|||||||
@@ -135,16 +135,16 @@ public abstract class AbstractReferenceResolveTest : KotlinLightPlatformCodeInsi
|
|||||||
val resolvedTo = psiReference.resolve()
|
val resolvedTo = psiReference.resolve()
|
||||||
if (resolvedTo != null) {
|
if (resolvedTo != null) {
|
||||||
val resolvedToElementStr = ReferenceUtils.renderAsGotoImplementation(resolvedTo)
|
val resolvedToElementStr = ReferenceUtils.renderAsGotoImplementation(resolvedTo)
|
||||||
assertEquals(expectedResolveData.referenceString, resolvedToElementStr, "Found reference to '$resolvedToElementStr', but '${expectedResolveData.referenceString}' was expected")
|
assertEquals("Found reference to '$resolvedToElementStr', but '${expectedResolveData.referenceString}' was expected", expectedResolveData.referenceString, resolvedToElementStr)
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (!expectedResolveData.shouldBeUnresolved()) {
|
if (!expectedResolveData.shouldBeUnresolved()) {
|
||||||
assertNull(expectedResolveData.referenceString, "Element $psiReference wasn't resolved to anything, but ${expectedResolveData.referenceString} was expected")
|
assertNull("Element $psiReference wasn't resolved to anything, but ${expectedResolveData.referenceString} was expected", expectedResolveData.referenceString)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
assertNull(expectedResolveData.referenceString, "No reference found at offset: $offset, but one resolved to ${expectedResolveData.referenceString} was expected")
|
assertNull("No reference found at offset: $offset, but one resolved to ${expectedResolveData.referenceString} was expected", expectedResolveData.referenceString)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user