Move isolated addSuppressed extension test to jvm tests

Conditions for being isolated do not hold anymore:
it tested that addSuppressed extension could work without kotlin-stdlib-jdk7,
but now the latter is merged to kotlin-stdlib and thus always present

#KT-51907
This commit is contained in:
Ilya Gorbunov
2023-01-20 05:22:44 +01:00
committed by Space Team
parent 8b68234528
commit 5a4eb22961
3 changed files with 13 additions and 43 deletions
-17
View File
@@ -17,11 +17,6 @@ sourceSets {
kotlin {
}
}
noJdk7Test {
kotlin {
srcDir 'testNoJdk7'
}
}
java9 {
java {
srcDir 'java9'
@@ -29,10 +24,6 @@ sourceSets {
}
}
configurations {
noJdk7TestApi.extendsFrom(testApi)
}
dependencies {
api project(':kotlin-stdlib')
testApi project(':kotlin-test:kotlin-test-junit')
@@ -88,12 +79,4 @@ configureFrontendIr(project)
LibrariesCommon.configureJava9Compilation(project, 'kotlin.stdlib.jdk7')
task testNoJdk7(type: Test, dependsOn: noJdk7TestClasses) {
group = "verification"
testClassesDirs = sourceSets.noJdk7Test.output.classesDirs
classpath = sourceSets.noJdk7Test.runtimeClasspath
}
check.dependsOn testNoJdk7
@@ -1,25 +0,0 @@
/*
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
package test.exceptions
import kotlin.addSuppressed as addSuppressedExtension
import kotlin.test.*
class ExceptionTest {
@Test
fun addSuppressedWorksWithoutJdk7Extensions() {
val e1 = Throwable()
val e2 = Exception("Suppressed")
assertTrue(e1.suppressedExceptions.isEmpty())
e1.addSuppressedExtension(e2)
assertSame(e2, e1.suppressed.singleOrNull())
assertSame(e2, e1.suppressedExceptions.singleOrNull())
}
}
@@ -85,7 +85,19 @@ class ExceptionJVMTest {
@Test
fun addSuppressedSelfDoesNotThrow() {
val e1 = Throwable()
e1.addSuppressed(e1) // should not throw
e1.addSuppressed(e1) // should not throw, extension hides member
}
@Test
fun addSuppressedWorksThroughExtension() {
val e1 = Throwable()
val e2 = Exception("Suppressed")
assertTrue(e1.suppressedExceptions.isEmpty())
e1.addSuppressed(e2)
assertSame(e2, e1.suppressed.singleOrNull())
assertSame(e2, e1.suppressedExceptions.singleOrNull())
}
@Test