From d1e6a611979efb48f24a8ad8d5a02442b8a3e12d Mon Sep 17 00:00:00 2001 From: Nikolay Krasko Date: Wed, 31 Jan 2018 16:12:46 +0300 Subject: [PATCH] Fix testInGlobalPropertyWithGetter test in 173 branch Workaround for IDEA-185462. It was introduced in 173 idea and fixed in 181. --- .../outOfBlock/InGlobalPropertyWithGetter.kt | 2 ++ .../AbstractOutOfBlockModificationTest.java | 15 +++++++++++---- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/idea/testData/codeInsight/outOfBlock/InGlobalPropertyWithGetter.kt b/idea/testData/codeInsight/outOfBlock/InGlobalPropertyWithGetter.kt index 74c94a1805b..f5038062b8d 100644 --- a/idea/testData/codeInsight/outOfBlock/InGlobalPropertyWithGetter.kt +++ b/idea/testData/codeInsight/outOfBlock/InGlobalPropertyWithGetter.kt @@ -1,4 +1,6 @@ // FALSE +// Important for 173 branch! OOCB is TRUE in this test because of IDEA-185462 + class B(val a: A) val B.foo: Int get() { diff --git a/idea/tests/org/jetbrains/kotlin/idea/codeInsight/AbstractOutOfBlockModificationTest.java b/idea/tests/org/jetbrains/kotlin/idea/codeInsight/AbstractOutOfBlockModificationTest.java index b5d0f8c76cc..54741a552cd 100644 --- a/idea/tests/org/jetbrains/kotlin/idea/codeInsight/AbstractOutOfBlockModificationTest.java +++ b/idea/tests/org/jetbrains/kotlin/idea/codeInsight/AbstractOutOfBlockModificationTest.java @@ -16,6 +16,7 @@ package org.jetbrains.kotlin.idea.codeInsight; +import com.intellij.ide.plugins.PluginManagerCore; import com.intellij.openapi.application.ApplicationManager; import com.intellij.openapi.util.io.FileUtil; import com.intellij.openapi.util.text.StringUtil; @@ -52,6 +53,16 @@ public abstract class AbstractOutOfBlockModificationTest extends KotlinLightCode myFixture.configureByFile(path); boolean expectedOutOfBlock = getExpectedOutOfBlockResult(); + boolean isSkipCheckDefined = InTextDirectivesUtils.isDirectiveDefined(myFixture.getFile().getText(), "SKIP_ANALYZE_CHECK"); + + if ("InGlobalPropertyWithGetter".equals(getTestName(false)) && PluginManagerCore.BUILD_NUMBER.contains("-173.")) { + expectedOutOfBlock = true; + isSkipCheckDefined = true; + } + + assertTrue("It's allowed to skip check with analyze only for tests where out-of-block is expected", + !isSkipCheckDefined || expectedOutOfBlock); + PsiModificationTrackerImpl tracker = (PsiModificationTrackerImpl) PsiManager.getInstance(myFixture.getProject()).getModificationTracker(); @@ -73,10 +84,6 @@ public abstract class AbstractOutOfBlockModificationTest extends KotlinLightCode assertEquals("Result for out of block test is differs from expected on element in file:\n" + FileUtil.loadFile(new File(path)), expectedOutOfBlock, oobBeforeType != oobAfterCount); - boolean isSkipCheckDefined = InTextDirectivesUtils.isDirectiveDefined(myFixture.getFile().getText(), "SKIP_ANALYZE_CHECK"); - assertTrue("It's allowed to skip check with analyze only for tests where out-of-block is expected", - !isSkipCheckDefined || expectedOutOfBlock); - if (!isSkipCheckDefined) { checkOOBWithDescriptorsResolve(expectedOutOfBlock); }