File tree Expand file tree Collapse file tree 3 files changed +3
-6
lines changed Expand file tree Collapse file tree 3 files changed +3
-6
lines changed Original file line number Diff line number Diff line change @@ -59,7 +59,6 @@ internal data class AdventTestConfig(
5959 val part : AdventDayPart ,
6060 val enabled : Boolean ,
6161 val partFunction : PartFunction ,
62- val expensive : Boolean ,
6362 val efficiencyBenchmark : Duration ,
6463 )
6564}
@@ -83,6 +82,5 @@ internal fun AdventTestConfig.forInput(defaults: AdventProjectConfig): AdventTes
8382 part = part,
8483 enabled = if (! enabled) false else (executionMode ? : defaults.executionMode) != ExecMode .ExamplesOnly ,
8584 partFunction = partFunction,
86- expensive = expensive,
8785 efficiencyBenchmark = efficiencyBenchmark ? : defaults.efficiencyBenchmark
8886 )
Original file line number Diff line number Diff line change @@ -11,6 +11,7 @@ import io.kotest.assertions.withClue
1111import io.kotest.common.ExperimentalKotest
1212import io.kotest.common.reflection.ReflectionInstantiations.newInstanceNoArgConstructorOrObjectInstance
1313import io.kotest.core.spec.style.scopes.FunSpecContainerScope
14+ import io.kotest.core.test.parents
1415import io.kotest.matchers.comparables.shouldBeLessThanOrEqualTo
1516import io.kotest.matchers.shouldBe
1617import kotlinx.coroutines.currentCoroutineContext
@@ -54,7 +55,7 @@ internal fun KClass<out AdventSpec<*>>.injectSolution(): Solution = this
5455internal fun AdventSpec <* >.registerTest (config : AdventTestConfig ): Unit = with (config) {
5556 context(" Part $part " ).config(
5657 enabled = enabled,
57- tags = if (expensive) setOf (Expensive ) else emptySet() ,
58+ tags = if (expensive) setOf (Expensive ) else null ,
5859 ) {
5960 val projectConfig = currentCoroutineContext()[AdventProjectConfig .Key ] ? : AdventProjectConfig .Default
6061 registerExamples(config.forExamples(projectConfig))
@@ -142,7 +143,7 @@ private suspend fun FunSpecContainerScope.registerInput(config: AdventTestConfig
142143 val enableSpeedTesting = when {
143144 correctAnswer == null -> false
144145 answer != correctAnswer -> false
145- expensive -> false
146+ testCase.parents().any { Expensive in it.config?.tags.orEmpty() } -> false
146147 else -> true
147148 }
148149
Original file line number Diff line number Diff line change @@ -144,15 +144,13 @@ class DslTest : FunSpec({
144144 finalConfig.part shouldBe configA.part
145145 finalConfig.enabled shouldBe true
146146 finalConfig.partFunction.invoke(PuzzleInput ("B ")) shouldBe PuzzleAnswer ("1:B ")
147- finalConfig.expensive shouldBe true
148147 finalConfig.efficiencyBenchmark shouldBe configA.efficiencyBenchmark
149148 }
150149 configB.forInput(AdventProjectConfig .Default ).should { finalConfig ->
151150 finalConfig.id shouldBe configB.id
152151 finalConfig.part shouldBe configB.part
153152 finalConfig.enabled shouldBe false
154153 finalConfig.partFunction.invoke(PuzzleInput ("B ")) shouldBe PuzzleAnswer ("2:1")
155- finalConfig.expensive shouldBe false
156154 finalConfig.efficiencyBenchmark shouldBe AdventProjectConfig .Default .efficiencyBenchmark
157155 }
158156 }
You can’t perform that action at this time.
0 commit comments