HMPP: Fix serialization of TargetPlatform in tests
This commit is contained in:
+26
@@ -0,0 +1,26 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module type="JAVA_MODULE" version="4">
|
||||
<component name="FacetManager">
|
||||
<facet type="kotlin-language" name="Kotlin">
|
||||
<configuration version="2" platform="Native " allPlatforms="Native []" useProjectSettings="false">
|
||||
<compilerSettings>
|
||||
<option name="additionalArguments" value="-version -Xallow-kotlin-package -Xskip-metadata-version-check" />
|
||||
</compilerSettings>
|
||||
<compilerArguments>
|
||||
<option name="languageVersion" value="1.1" />
|
||||
<option name="apiVersion" value="1.0" />
|
||||
<option name="coroutinesEnable" value="true" />
|
||||
</compilerArguments>
|
||||
</configuration>
|
||||
</facet>
|
||||
</component>
|
||||
<component name="NewModuleRootManager" inherit-compiler-output="true">
|
||||
<exclude-output />
|
||||
<content url="file://$MODULE_DIR$">
|
||||
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
|
||||
</content>
|
||||
<orderEntry type="jdk" jdkName="1.8" jdkType="JavaSDK" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
<orderEntry type="library" name="KotlinJavaRuntime (2)" level="project" />
|
||||
</component>
|
||||
</module>
|
||||
+41
@@ -0,0 +1,41 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="CompilerConfiguration">
|
||||
<resourceExtensions />
|
||||
<wildcardResourcePatterns>
|
||||
<entry name="!?*.java" />
|
||||
<entry name="!?*.form" />
|
||||
<entry name="!?*.class" />
|
||||
<entry name="!?*.groovy" />
|
||||
<entry name="!?*.scala" />
|
||||
<entry name="!?*.flex" />
|
||||
<entry name="!?*.kt" />
|
||||
<entry name="!?*.clj" />
|
||||
<entry name="!?*.aj" />
|
||||
</wildcardResourcePatterns>
|
||||
<annotationProcessing>
|
||||
<profile default="true" name="Default" enabled="false">
|
||||
<processorPath useClasspath="true" />
|
||||
</profile>
|
||||
</annotationProcessing>
|
||||
</component>
|
||||
<component name="CopyrightManager" default="" />
|
||||
<component name="ProjectModuleManager">
|
||||
<modules>
|
||||
<module fileurl="file://$PROJECT_DIR$/module.iml" filepath="$PROJECT_DIR$/module.iml" />
|
||||
</modules>
|
||||
</component>
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="true" assert-keyword="true" jdk-15="true" project-jdk-name="1.8" project-jdk-type="JavaSDK">
|
||||
<output url="file://$PROJECT_DIR$/out" />
|
||||
</component>
|
||||
<component name="libraryTable">
|
||||
<library name="KotlinJavaRuntime (2)">
|
||||
<CLASSES>
|
||||
<root url="jar://$PROJECT_DIR$/../mockRuntime11/kotlin-runtime.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC />
|
||||
<SOURCES>
|
||||
</SOURCES>
|
||||
</library>
|
||||
</component>
|
||||
</project>
|
||||
+27
-34
@@ -107,43 +107,26 @@ open class ConfigureKotlinInTempDirTest : AbstractConfigureKotlinInTempDirTest()
|
||||
}
|
||||
|
||||
|
||||
fun testLoadAndSaveOldNativeFacet() {
|
||||
val moduleFileContentBefore = String(module.moduleFile!!.contentsToByteArray())
|
||||
val application = ApplicationManager.getApplication() as ApplicationImpl
|
||||
application.isSaveAllowed = true
|
||||
application.saveAll()
|
||||
val moduleFileContentAfter = String(module.moduleFile!!.contentsToByteArray())
|
||||
Assert.assertEquals(
|
||||
moduleFileContentBefore.replace("platform=\"Native \"", "platform=\"Native \" allPlatforms=\"Native []\""),
|
||||
moduleFileContentAfter
|
||||
)
|
||||
}
|
||||
fun testLoadAndSaveOldNativePlatformOldNativeFacet() = doTestLoadAndSaveProjectWithFacetConfig(
|
||||
"platform=\"Native \"",
|
||||
"platform=\"Native (general) \" allPlatforms=\"Native [general]\""
|
||||
)
|
||||
|
||||
fun testLoadAndSaveOldNativePlatformNewNativeFacet() = doTestLoadAndSaveProjectWithFacetConfig(
|
||||
"platform=\"Native \" allPlatforms=\"Native []\"",
|
||||
"platform=\"Native (general) \" allPlatforms=\"Native [general]\""
|
||||
)
|
||||
|
||||
//TODO(auskov): test parsing common target platform with multiple versions of java, add parsing common platforms
|
||||
fun testLoadAndSaveProjectWithV2OldPlatformFacetConfig() {
|
||||
val moduleFileContentBefore = String(module.moduleFile!!.contentsToByteArray())
|
||||
val application = ApplicationManager.getApplication() as ApplicationImpl
|
||||
application.isSaveAllowed = true
|
||||
application.saveAll()
|
||||
val moduleFileContentAfter = String(module.moduleFile!!.contentsToByteArray())
|
||||
Assert.assertEquals(
|
||||
moduleFileContentBefore.replace("platform=\"JVM 1.8\"", "platform=\"JVM 1.8\" allPlatforms=\"JVM [1.8]\""),
|
||||
moduleFileContentAfter
|
||||
)
|
||||
}
|
||||
|
||||
fun testLoadAndSaveProjectHMPPFacetConfig() {
|
||||
val moduleFileContentBefore = String(module.moduleFile!!.contentsToByteArray())
|
||||
val application = ApplicationManager.getApplication() as ApplicationImpl
|
||||
application.isSaveAllowed = true
|
||||
application.saveAll()
|
||||
val moduleFileContentAfter = String(module.moduleFile!!.contentsToByteArray())
|
||||
Assert.assertEquals(
|
||||
moduleFileContentBefore.replace("platform=\"JVM 1.8\"", "platform=\"JVM 1.8\" allPlatforms=\"JVM [1.8]\""),
|
||||
moduleFileContentAfter
|
||||
)
|
||||
}
|
||||
fun testLoadAndSaveProjectWithV2OldPlatformFacetConfig() = doTestLoadAndSaveProjectWithFacetConfig(
|
||||
"platform=\"JVM 1.8\"",
|
||||
"platform=\"JVM 1.8\" allPlatforms=\"JVM [1.8]\""
|
||||
)
|
||||
|
||||
fun testLoadAndSaveProjectHMPPFacetConfig() = doTestLoadAndSaveProjectWithFacetConfig(
|
||||
"platform=\"Common (experimental) \" allPlatforms=\"JS []/JVM [1.6]/Native []\"",
|
||||
"platform=\"Common (experimental) \" allPlatforms=\"JS []/JVM [1.6]/Native [general]\""
|
||||
)
|
||||
|
||||
fun testApiVersionWithoutLanguageVersion() {
|
||||
KotlinCommonCompilerArgumentsHolder.getInstance(myProject)
|
||||
@@ -161,4 +144,14 @@ open class ConfigureKotlinInTempDirTest : AbstractConfigureKotlinInTempDirTest()
|
||||
application.saveAll()
|
||||
Assert.assertTrue(project.baseDir.findFileByRelativePath(".idea/kotlinc.xml") == null)
|
||||
}
|
||||
|
||||
private fun doTestLoadAndSaveProjectWithFacetConfig(valueBefore: String, valueAfter: String) {
|
||||
val moduleFileContentBefore = String(module.moduleFile!!.contentsToByteArray())
|
||||
Assert.assertTrue(moduleFileContentBefore.contains(valueBefore))
|
||||
val application = ApplicationManager.getApplication() as ApplicationImpl
|
||||
application.isSaveAllowed = true
|
||||
application.saveAll()
|
||||
val moduleFileContentAfter = String(module.moduleFile!!.contentsToByteArray())
|
||||
Assert.assertEquals(moduleFileContentBefore.replace(valueBefore, valueAfter), moduleFileContentAfter)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user