From 1a76eabbc022c580dc4f703c6fecace002b00db1 Mon Sep 17 00:00:00 2001 From: Evgenii Novozhilov Date: Tue, 28 Jan 2025 18:05:23 +0200 Subject: [PATCH] testFramework: provide String overload for Registry.withValue (cherry picked from commit 11d21d3c52bfa544f58b0f4f191eb0b2a282b424) GitOrigin-RevId: e41853fc1ec1cedd981bb8d4c139635bc1de6e39 --- .../openapi/util/registry/RegistryTestUtil.kt | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/platform/testFramework/src/com/intellij/openapi/util/registry/RegistryTestUtil.kt b/platform/testFramework/src/com/intellij/openapi/util/registry/RegistryTestUtil.kt index 316d75df65ef..f6d490a8ef05 100644 --- a/platform/testFramework/src/com/intellij/openapi/util/registry/RegistryTestUtil.kt +++ b/platform/testFramework/src/com/intellij/openapi/util/registry/RegistryTestUtil.kt @@ -11,4 +11,15 @@ inline fun RegistryValue.withValue(tempValue: Boolean, crossinline block: () -> finally { setValue(currentValue) } -} \ No newline at end of file +} + +inline fun RegistryValue.withValue(tempValue: String, crossinline block: () -> Unit) { + val currentValue = asBoolean() + try { + setValue(tempValue) + block() + } + finally { + setValue(currentValue) + } +}