Skip to content

Commit

Permalink
Move ListAllCoroutineThrowableSubclassesTest to integration-testing a…
Browse files Browse the repository at this point in the history
…nd fix assertion
  • Loading branch information
qwwdfsad committed Jun 22, 2022
1 parent e32aa78 commit bd26f72
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 9 deletions.
9 changes: 8 additions & 1 deletion integration-testing/build.gradle
Expand Up @@ -23,6 +23,13 @@ dependencies {
}

sourceSets {
test {
kotlin
dependencies {
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutines_version"
implementation 'com.google.guava:guava:31.1-jre'
}
}
mavenTest {
kotlin
compileClasspath += sourceSets.test.runtimeClasspath
Expand Down Expand Up @@ -89,5 +96,5 @@ compileTestKotlin {
}

check {
dependsOn([mavenTest, debugAgentTest, coreAgentTest, 'smokeTest:build'])
dependsOn([test, mavenTest, debugAgentTest, coreAgentTest, 'smokeTest:build'])
}
Expand Up @@ -2,14 +2,14 @@
* Copyright 2016-2022 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
*/

package kotlinx.coroutines.guava
package kotlinx.coroutines

import com.google.common.reflect.*
import kotlinx.coroutines.*
import org.junit.Test
import kotlin.test.*

class ListAllCoroutineThrowableSubclassesTest : TestBase() {
class ListAllCoroutineThrowableSubclassesTest {

/*
* These are all known throwables in kotlinx.coroutines.
Expand All @@ -33,7 +33,6 @@ class ListAllCoroutineThrowableSubclassesTest : TestBase() {
"kotlinx.coroutines.channels.ClosedReceiveChannelException",
"kotlinx.coroutines.flow.internal.ChildCancelledException",
"kotlinx.coroutines.flow.internal.AbortFlowException",

)

@Test
Expand All @@ -44,15 +43,11 @@ class ListAllCoroutineThrowableSubclassesTest : TestBase() {
classes.forEach {
try {
if (Throwable::class.java.isAssignableFrom(it.load())) {
// Skip classes from test sources
if (it.load().protectionDomain.codeSource.location.toString().contains("/test/")) {
return@forEach
}
++throwables
// println(""""$it",""")
assertTrue(knownThrowables.contains(it.toString()))
}
} catch (e: Throwable) {
} catch (e: LinkageError) {
// Ignore unloadable classes
}
}
Expand Down

0 comments on commit bd26f72

Please sign in to comment.