Skip to content

Commit

Permalink
Clean up
Browse files Browse the repository at this point in the history
  • Loading branch information
zuevmaxim committed Jun 25, 2024
1 parent b38df97 commit 96855a8
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions test-kotlin/test-utils/src/com/intellij/rt/coverage/runner.kt
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import com.intellij.rt.coverage.util.CoverageRunner
import com.intellij.rt.coverage.util.ResourceUtil
import org.junit.Assert
import java.io.File
import kotlin.reflect.KMutableProperty
import kotlin.reflect.KMutableProperty0


abstract class TestResult {
Expand Down Expand Up @@ -156,13 +156,13 @@ internal fun runWithCoverage(
.also { assertEmptyLogFile(coverageDataFile) }
}

inline fun runWithOptions(values: Map<KMutableProperty<Boolean>, Boolean>, action: () -> Unit) {
val originalValues = values.mapValues { it.key.getter.call() }
values.forEach { (field, value) -> field.setter.call(value) }
inline fun runWithOptions(values: Map<KMutableProperty0<Boolean>, Boolean>, action: () -> Unit) {
val originalValues = values.mapValues { it.key.get() }
values.forEach { (field, value) -> field.set(value) }
try {
action()
} finally {
originalValues.forEach { (field, value) -> field.setter.call(value) }
originalValues.forEach { (field, value) -> field.set(value) }
}
}

Expand Down

0 comments on commit 96855a8

Please sign in to comment.