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() {
|
fun testLoadAndSaveOldNativePlatformOldNativeFacet() = doTestLoadAndSaveProjectWithFacetConfig(
|
||||||
val moduleFileContentBefore = String(module.moduleFile!!.contentsToByteArray())
|
"platform=\"Native \"",
|
||||||
val application = ApplicationManager.getApplication() as ApplicationImpl
|
"platform=\"Native (general) \" allPlatforms=\"Native [general]\""
|
||||||
application.isSaveAllowed = true
|
)
|
||||||
application.saveAll()
|
|
||||||
val moduleFileContentAfter = String(module.moduleFile!!.contentsToByteArray())
|
fun testLoadAndSaveOldNativePlatformNewNativeFacet() = doTestLoadAndSaveProjectWithFacetConfig(
|
||||||
Assert.assertEquals(
|
"platform=\"Native \" allPlatforms=\"Native []\"",
|
||||||
moduleFileContentBefore.replace("platform=\"Native \"", "platform=\"Native \" allPlatforms=\"Native []\""),
|
"platform=\"Native (general) \" allPlatforms=\"Native [general]\""
|
||||||
moduleFileContentAfter
|
)
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
//TODO(auskov): test parsing common target platform with multiple versions of java, add parsing common platforms
|
//TODO(auskov): test parsing common target platform with multiple versions of java, add parsing common platforms
|
||||||
fun testLoadAndSaveProjectWithV2OldPlatformFacetConfig() {
|
fun testLoadAndSaveProjectWithV2OldPlatformFacetConfig() = doTestLoadAndSaveProjectWithFacetConfig(
|
||||||
val moduleFileContentBefore = String(module.moduleFile!!.contentsToByteArray())
|
"platform=\"JVM 1.8\"",
|
||||||
val application = ApplicationManager.getApplication() as ApplicationImpl
|
"platform=\"JVM 1.8\" allPlatforms=\"JVM [1.8]\""
|
||||||
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 testLoadAndSaveProjectHMPPFacetConfig() = doTestLoadAndSaveProjectWithFacetConfig(
|
||||||
|
"platform=\"Common (experimental) \" allPlatforms=\"JS []/JVM [1.6]/Native []\"",
|
||||||
|
"platform=\"Common (experimental) \" allPlatforms=\"JS []/JVM [1.6]/Native [general]\""
|
||||||
|
)
|
||||||
|
|
||||||
fun testApiVersionWithoutLanguageVersion() {
|
fun testApiVersionWithoutLanguageVersion() {
|
||||||
KotlinCommonCompilerArgumentsHolder.getInstance(myProject)
|
KotlinCommonCompilerArgumentsHolder.getInstance(myProject)
|
||||||
@@ -161,4 +144,14 @@ open class ConfigureKotlinInTempDirTest : AbstractConfigureKotlinInTempDirTest()
|
|||||||
application.saveAll()
|
application.saveAll()
|
||||||
Assert.assertTrue(project.baseDir.findFileByRelativePath(".idea/kotlinc.xml") == null)
|
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