From 946e9b02ffd080af820603ccddeeacd40a8b4d2a Mon Sep 17 00:00:00 2001 From: Maksim Kurnikov Date: Mon, 2 Dec 2024 17:51:40 +0100 Subject: [PATCH] 243 is RR, skip two tests behaving differently on RR --- gradle-243.properties | 6 ++-- gradle.properties | 3 ++ src/main/kotlin/org/move/cli/MvConstants.kt | 2 -- .../MoveExternalSystemProjectAwareTest.kt | 5 ++++ .../org/move/utils/tests/MvLightTestBase.kt | 2 ++ .../org/move/utils/tests/MvProjectTestBase.kt | 29 +++++++++++++++++++ 6 files changed, 42 insertions(+), 5 deletions(-) diff --git a/gradle-243.properties b/gradle-243.properties index e53cf7a76..38aa10e40 100644 --- a/gradle-243.properties +++ b/gradle-243.properties @@ -4,12 +4,12 @@ pluginSinceBuild = 243 pluginUntilBuild = 243.* # IntelliJ Platform Properties -> https://github.com/JetBrains/gradle-intellij-plugin#intellij-platform-properties -platformType = IC -platformVersion = 243.21565-EAP-CANDIDATE-SNAPSHOT +platformType = RR +platformVersion = 2024.3 # Plugin Dependencies -> https://plugins.jetbrains.com/docs/intellij/plugin-dependencies.html # Example: platformPlugins = com.intellij.java, com.jetbrains.php:203.4449.22 platformPlugins = org.toml.lang # should be false when using EAP builds -useInstaller=false +useInstaller=true diff --git a/gradle.properties b/gradle.properties index 9c2d53acf..f24458126 100644 --- a/gradle.properties +++ b/gradle.properties @@ -5,6 +5,9 @@ # See https://kotlinlang.org/docs/reference/using-gradle.html#dependency-on-the-standard-library for more details kotlin.stdlib.default.dependency=false +# Intellij SDK sources +org.jetbrains.intellij.platform.downloadSources=true + # Workaround for Kotlin 1.8.20+ #kotlin.incremental.useClasspathSnapshot=false diff --git a/src/main/kotlin/org/move/cli/MvConstants.kt b/src/main/kotlin/org/move/cli/MvConstants.kt index 58da356e5..dccb569b2 100644 --- a/src/main/kotlin/org/move/cli/MvConstants.kt +++ b/src/main/kotlin/org/move/cli/MvConstants.kt @@ -20,6 +20,4 @@ object MvConstants { const val ADDR_PLACEHOLDER = "_" const val PSI_FACTORY_DUMMY_FILE = "DUMMY_PSI_FACTORY.move" - - val PROJECT_SYSTEM_ID = ProjectSystemId("Move") } diff --git a/src/test/kotlin/org/move/cli/externalSystem/MoveExternalSystemProjectAwareTest.kt b/src/test/kotlin/org/move/cli/externalSystem/MoveExternalSystemProjectAwareTest.kt index 2b18f58fb..af1c04778 100644 --- a/src/test/kotlin/org/move/cli/externalSystem/MoveExternalSystemProjectAwareTest.kt +++ b/src/test/kotlin/org/move/cli/externalSystem/MoveExternalSystemProjectAwareTest.kt @@ -12,6 +12,7 @@ import com.intellij.util.PathUtil import org.move.cli.MoveProjectsService import org.move.lang.core.psi.MvPath import org.move.utils.tests.MvProjectTestBase +import org.move.utils.tests.SkipOnProduct import org.move.utils.tests.TestProject import org.move.utils.tests.waitFinished import java.io.IOException @@ -33,6 +34,9 @@ class MoveExternalSystemProjectAwareTest: MvProjectTestBase() { AutoImportProjectTracker.enableAutoReloadInTests(testRootDisposable) } + // RustRover does not work due to extra call to reloadProject() after the modification of Move.toml, + // but works on IC, PC just fine + @SkipOnProduct("RustRover") fun `test modifications`() { val testProject = testProject { namedMoveToml("RootPackage") @@ -146,6 +150,7 @@ compiled_package_info: // testProject.checkFileRename("liquidswap_init/MyMove.toml", "Move.toml", triggered = true) // } + @SkipOnProduct("RustRover") fun `test reloading`() { val testProject = testProject { moveToml( diff --git a/src/test/kotlin/org/move/utils/tests/MvLightTestBase.kt b/src/test/kotlin/org/move/utils/tests/MvLightTestBase.kt index f6eee27d3..5d3b9d712 100644 --- a/src/test/kotlin/org/move/utils/tests/MvLightTestBase.kt +++ b/src/test/kotlin/org/move/utils/tests/MvLightTestBase.kt @@ -3,6 +3,7 @@ package org.move.utils.tests import com.intellij.testFramework.fixtures.BasePlatformTestCase abstract class MvLightTestBase: BasePlatformTestCase() { + override fun setUp() { super.setUp() @@ -12,4 +13,5 @@ abstract class MvLightTestBase: BasePlatformTestCase() { this.handleMoveV2Annotation(project) this.handleNamedAddressAnnotations(project) } + } \ No newline at end of file diff --git a/src/test/kotlin/org/move/utils/tests/MvProjectTestBase.kt b/src/test/kotlin/org/move/utils/tests/MvProjectTestBase.kt index 10d9e2016..671171c24 100644 --- a/src/test/kotlin/org/move/utils/tests/MvProjectTestBase.kt +++ b/src/test/kotlin/org/move/utils/tests/MvProjectTestBase.kt @@ -1,5 +1,6 @@ package org.move.utils.tests +import com.intellij.openapi.application.ApplicationNamesInfo import com.intellij.openapi.project.rootManager import com.intellij.openapi.util.io.FileUtil import com.intellij.openapi.util.registry.Registry @@ -12,6 +13,7 @@ import com.intellij.testFramework.builders.ModuleFixtureBuilder import com.intellij.testFramework.fixtures.CodeInsightFixtureTestCase import com.intellij.testFramework.fixtures.CodeInsightTestFixture import com.intellij.util.SystemProperties +import com.intellij.util.ThrowableRunnable import com.intellij.util.ui.UIUtil import org.intellij.lang.annotations.Language import org.jetbrains.annotations.TestOnly @@ -20,13 +22,30 @@ import org.move.openapiext.toPsiDirectory import org.move.openapiext.toPsiFile import org.move.openapiext.toVirtualFile import org.move.utils.tests.base.TestCase +import java.lang.annotation.Inherited @TestOnly fun setRegistryKey(key: String, value: Boolean) = Registry.get(key).setValue(value) +@Inherited +@Target(AnnotationTarget.FUNCTION, AnnotationTarget.CLASS) +@Retention(AnnotationRetention.RUNTIME) +annotation class SkipOnProduct(val product: String) + +fun MvProjectTestBase.handleSkipOnProductAnnotations() { + val currentProduct = ApplicationNamesInfo.getInstance().fullProductName + val skipOnProducts = this.findAnnotationInstances() + for (skipOn in skipOnProducts) { + if (skipOn.product == currentProduct) { + this.skipTestWithReason = "Skip on ${skipOn.product}" + } + } +} + abstract class MvProjectTestBase: CodeInsightFixtureTestCase>() { // var isProjectInitialized: Boolean = false + var skipTestWithReason: String? = null override fun setUp() { super.setUp() @@ -35,6 +54,16 @@ abstract class MvProjectTestBase: CodeInsightFixtureTestCase) { + val reason = this.skipTestWithReason + if (reason != null) { + System.err.println("SKIP \"$name\": $reason") + return + } + super.runTestRunnable(testRunnable) } // override fun tearDown() {