Skip to content

Commit

Permalink
243 is RR, skip two tests behaving differently on RR (#257)
Browse files Browse the repository at this point in the history
  • Loading branch information
mkurnikov authored Dec 2, 2024
1 parent 19a1c7f commit 3393e65
Show file tree
Hide file tree
Showing 6 changed files with 42 additions and 5 deletions.
6 changes: 3 additions & 3 deletions gradle-243.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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
3 changes: 3 additions & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 0 additions & 2 deletions src/main/kotlin/org/move/cli/MvConstants.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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")
}
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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")
Expand Down Expand Up @@ -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(
Expand Down
2 changes: 2 additions & 0 deletions src/test/kotlin/org/move/utils/tests/MvLightTestBase.kt
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package org.move.utils.tests
import com.intellij.testFramework.fixtures.BasePlatformTestCase

abstract class MvLightTestBase: BasePlatformTestCase() {

override fun setUp() {
super.setUp()

Expand All @@ -12,4 +13,5 @@ abstract class MvLightTestBase: BasePlatformTestCase() {
this.handleMoveV2Annotation(project)
this.handleNamedAddressAnnotations(project)
}

}
29 changes: 29 additions & 0 deletions src/test/kotlin/org/move/utils/tests/MvProjectTestBase.kt
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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
Expand All @@ -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<SkipOnProduct>()
for (skipOn in skipOnProducts) {
if (skipOn.product == currentProduct) {
this.skipTestWithReason = "Skip on ${skipOn.product}"
}
}
}

abstract class MvProjectTestBase: CodeInsightFixtureTestCase<ModuleFixtureBuilder<*>>() {

// var isProjectInitialized: Boolean = false
var skipTestWithReason: String? = null

override fun setUp() {
super.setUp()
Expand All @@ -35,6 +54,16 @@ abstract class MvProjectTestBase: CodeInsightFixtureTestCase<ModuleFixtureBuilde
setRegistryKey("org.move.debug.enabled", isDebugMode)

this.handleMoveV2Annotation(project)
this.handleSkipOnProductAnnotations()
}

override fun runTestRunnable(testRunnable: ThrowableRunnable<Throwable>) {
val reason = this.skipTestWithReason
if (reason != null) {
System.err.println("SKIP \"$name\": $reason")
return
}
super.runTestRunnable(testRunnable)
}

// override fun tearDown() {
Expand Down

0 comments on commit 3393e65

Please sign in to comment.