Skip to content

Commit 188ab3d

Browse files
committed
Move ListAllCoroutineThrowableSubclassesTest to integration-testing and fix assertion
1 parent e32aa78 commit 188ab3d

File tree

2 files changed

+11
-11
lines changed

2 files changed

+11
-11
lines changed

integration-testing/build.gradle

+8-1
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,13 @@ dependencies {
2323
}
2424

2525
sourceSets {
26+
test {
27+
kotlin
28+
dependencies {
29+
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutines_version"
30+
implementation 'com.google.guava:guava:31.1-jre'
31+
}
32+
}
2633
mavenTest {
2734
kotlin
2835
compileClasspath += sourceSets.test.runtimeClasspath
@@ -89,5 +96,5 @@ compileTestKotlin {
8996
}
9097

9198
check {
92-
dependsOn([mavenTest, debugAgentTest, coreAgentTest, 'smokeTest:build'])
99+
dependsOn([test, mavenTest, debugAgentTest, coreAgentTest, 'smokeTest:build'])
93100
}

integration/kotlinx-coroutines-guava/test/ListAllCoroutineThrowableSubclassesTest.kt renamed to integration-testing/src/test/kotlin/ListAllCoroutineThrowableSubclassesTest.kt

+3-10
Original file line numberDiff line numberDiff line change
@@ -2,23 +2,21 @@
22
* Copyright 2016-2022 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
33
*/
44

5-
package kotlinx.coroutines.guava
5+
package kotlinx.coroutines
66

77
import com.google.common.reflect.*
88
import kotlinx.coroutines.*
99
import org.junit.Test
1010
import kotlin.test.*
1111

12-
class ListAllCoroutineThrowableSubclassesTest : TestBase() {
12+
class ListAllCoroutineThrowableSubclassesTest {
1313

1414
/*
1515
* These are all known throwables in kotlinx.coroutines.
1616
* If you have added one, this test will fail to make
1717
* you ensure your exception type is java.io.Serializable.
1818
*
1919
* We do not have means to check it automatically, so checks are delegated to humans.
20-
* Also, this test meant to be in kotlinx-coroutines-core, but properly scanning classpath
21-
* requires guava which is toxic dependency that we'd like to avoid even in tests.
2220
*
2321
* See #3328 for serialization rationale.
2422
*/
@@ -33,7 +31,6 @@ class ListAllCoroutineThrowableSubclassesTest : TestBase() {
3331
"kotlinx.coroutines.channels.ClosedReceiveChannelException",
3432
"kotlinx.coroutines.flow.internal.ChildCancelledException",
3533
"kotlinx.coroutines.flow.internal.AbortFlowException",
36-
3734
)
3835

3936
@Test
@@ -44,15 +41,11 @@ class ListAllCoroutineThrowableSubclassesTest : TestBase() {
4441
classes.forEach {
4542
try {
4643
if (Throwable::class.java.isAssignableFrom(it.load())) {
47-
// Skip classes from test sources
48-
if (it.load().protectionDomain.codeSource.location.toString().contains("/test/")) {
49-
return@forEach
50-
}
5144
++throwables
5245
// println(""""$it",""")
5346
assertTrue(knownThrowables.contains(it.toString()))
5447
}
55-
} catch (e: Throwable) {
48+
} catch (e: LinkageError) {
5649
// Ignore unloadable classes
5750
}
5851
}

0 commit comments

Comments
 (0)