-
Notifications
You must be signed in to change notification settings - Fork 624
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
86 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
69 changes: 69 additions & 0 deletions
69
...ine/src/jvmTest/kotlin/com/sksamuel/kotest/engine/config/ApplyTagInheritanceConfigTest.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
package com.sksamuel.kotest.engine.config | ||
|
||
import io.kotest.core.config.AbstractProjectConfig | ||
import io.kotest.core.config.LogLevel | ||
import io.kotest.core.config.ProjectConfiguration | ||
import io.kotest.core.internal.KotestEngineProperties | ||
import io.kotest.core.spec.Isolate | ||
import io.kotest.core.spec.style.FunSpec | ||
import io.kotest.engine.config.applyConfigFromProjectConfig | ||
import io.kotest.engine.config.applyConfigFromSystemProperties | ||
import io.kotest.extensions.system.OverrideMode | ||
import io.kotest.extensions.system.withEnvironment | ||
import io.kotest.extensions.system.withSystemProperty | ||
import io.kotest.matchers.shouldBe | ||
|
||
private const val key = KotestEngineProperties.tagInheritance | ||
|
||
@Isolate | ||
class ApplyTagInheritanceConfigTest : FunSpec({ | ||
test("tag inheritance can come from sys props") { | ||
val config = ProjectConfiguration() | ||
|
||
config.tagInheritance shouldBe false | ||
|
||
withEnvironment(key, "false", OverrideMode.SetOrOverride) { | ||
withSystemProperty(key, "true", OverrideMode.SetOrOverride) { | ||
applyConfigFromSystemProperties(config) | ||
} | ||
} | ||
|
||
config.tagInheritance shouldBe true | ||
} | ||
|
||
test("tag inheritance can come from env vars with dots in name") { | ||
val config = ProjectConfiguration() | ||
|
||
config.tagInheritance shouldBe false | ||
|
||
withEnvironment(key, "true", OverrideMode.SetOrOverride) { | ||
applyConfigFromSystemProperties(config) | ||
} | ||
|
||
config.tagInheritance shouldBe true | ||
} | ||
|
||
test("tag inheritance can come from env vars with underscores in name") { | ||
val config = ProjectConfiguration() | ||
|
||
config.tagInheritance shouldBe false | ||
|
||
withEnvironment(key.replace('.', '_'), "TRUE", OverrideMode.SetOrOverride) { | ||
applyConfigFromSystemProperties(config) | ||
} | ||
|
||
config.tagInheritance shouldBe true | ||
} | ||
|
||
test("Tag inheritance can come from AbstractProjectConfig") { | ||
val config = ProjectConfiguration() | ||
|
||
config.tagInheritance shouldBe false | ||
|
||
applyConfigFromProjectConfig(object : AbstractProjectConfig() { | ||
override val tagInheritance = true | ||
}, config) | ||
|
||
config.tagInheritance shouldBe true | ||
} | ||
}) |