diff --git a/platform/testFramework/src/com/intellij/openapi/util/registry/RegistryTestUtil.kt b/platform/testFramework/src/com/intellij/openapi/util/registry/RegistryTestUtil.kt new file mode 100644 index 000000000000..eb32c8b4176e --- /dev/null +++ b/platform/testFramework/src/com/intellij/openapi/util/registry/RegistryTestUtil.kt @@ -0,0 +1,14 @@ +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +@file:JvmName("RegistryTestUtil") +package com.intellij.openapi.util.registry + +fun RegistryValue.withValue(tempValue: Boolean, block: () -> Unit) { + val currentValue = asBoolean() + try { + setValue(tempValue) + block() + } + finally { + setValue(currentValue) + } +} \ No newline at end of file