From 9fb3eb87a2117ca927dd7dde37d9feee8d792baa Mon Sep 17 00:00:00 2001 From: Cedric Beust Date: Wed, 7 Sep 2016 09:53:32 -0700 Subject: [PATCH] Launch the test JVM with "-ea". Fixes https://github.com/cbeust/kobalt/issues/303. --- .../kotlin/com/beust/kobalt/internal/GenericRunner.kt | 1 + .../kotlin/com/beust/kobalt/internal/DependencyTest.kt | 8 ++++---- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/modules/kobalt-plugin-api/src/main/kotlin/com/beust/kobalt/internal/GenericRunner.kt b/modules/kobalt-plugin-api/src/main/kotlin/com/beust/kobalt/internal/GenericRunner.kt index b5874432..c0362ea7 100644 --- a/modules/kobalt-plugin-api/src/main/kotlin/com/beust/kobalt/internal/GenericRunner.kt +++ b/modules/kobalt-plugin-api/src/main/kotlin/com/beust/kobalt/internal/GenericRunner.kt @@ -146,6 +146,7 @@ abstract class GenericTestRunner: ITestRunnerContributor { // Default JVM args val jvmFlags = arrayListOf().apply { addAll(testConfig.jvmArgs) + add("-ea") add("-classpath") add(classpath.map { it.jarFile.get().absolutePath }.joinToString(File.pathSeparator)) } diff --git a/src/test/kotlin/com/beust/kobalt/internal/DependencyTest.kt b/src/test/kotlin/com/beust/kobalt/internal/DependencyTest.kt index 95ff078c..74db351e 100644 --- a/src/test/kotlin/com/beust/kobalt/internal/DependencyTest.kt +++ b/src/test/kotlin/com/beust/kobalt/internal/DependencyTest.kt @@ -50,19 +50,19 @@ class DependencyTest @Inject constructor(val context: KobaltContext) { @Test fun noContributorsNoInterceptors() { - runTest(BasePluginInfo(), listOf("-classpath", A_JAR)) + runTest(BasePluginInfo(), listOf("-ea", "-classpath", A_JAR)) } @Test fun contributorOnly() { runTest(BasePluginInfo().apply { testJvmFlagContributors.add(contributor) }, - listOf("-classpath", A_JAR, "-agent", "foo")) + listOf("-ea", "-classpath", A_JAR, "-agent", "foo")) } @Test fun interceptorOnly() { runTest(BasePluginInfo().apply { testJvmFlagInterceptors.add(interceptor) }, - listOf("-classpath", B_JAR)) + listOf("-ea", "-classpath", B_JAR)) } @Test @@ -71,7 +71,7 @@ class DependencyTest @Inject constructor(val context: KobaltContext) { testJvmFlagContributors.add(contributor) testJvmFlagInterceptors.add(interceptor) }, - listOf("-classpath", B_JAR, "-agent", "foo")) + listOf("-ea", "-classpath", B_JAR, "-agent", "foo")) } }