Added import-resolve integration tests

This commit is contained in:
Andrey Uskov
2019-11-14 21:06:54 +03:00
parent e9946b21b5
commit 9643d5d28e
16 changed files with 306 additions and 69 deletions
@@ -0,0 +1,59 @@
plugins {
id 'org.jetbrains.kotlin.multiplatform' version '{{kotlin_plugin_version}}'
}
repositories {
mavenCentral()
}
group 'com.example'
version '0.0.1'
apply plugin: 'maven-publish'
kotlin {
jvm()
js {
browser {
}
nodejs {
}
}
sourceSets {
commonMain {
dependencies {
implementation kotlin('stdlib-common')
}
}
commonTest {
dependencies {
implementation kotlin('test-common')
implementation kotlin('test-annotations-common')
}
}
jvmMain {
dependencies {
implementation kotlin('stdlib-jdk8')
}
}
jvmTest {
dependencies {
implementation kotlin('test')
implementation kotlin('test-junit')
}
}
jsMain {
dependencies {
implementation kotlin('stdlib-js')
}
}
jsTest {
dependencies {
implementation kotlin('test-js')
}
}
mingwMain {
}
mingwTest {
}
}
}
@@ -0,0 +1 @@
kotlin.code.style=official
@@ -0,0 +1,3 @@
rootProject.name = 'mppLibrary'
enableFeaturePreview('GRADLE_METADATA')
@@ -0,0 +1,11 @@
package sample
expect class <lineMarker descr="Has actuals in JS, JVM">Sample</lineMarker>() {
fun <lineMarker>checkMe</lineMarker>(): Int
}
expect object <lineMarker descr="Has actuals in JS, JVM">Platform</lineMarker> {
val <lineMarker descr="Has actuals in JS, JVM">name</lineMarker>: String
}
fun hello(): String = "Hello from ${Platform.name}"
@@ -0,0 +1,11 @@
package sample
import kotlin.test.Test
import kotlin.test.assertTrue
class <lineMarker descr="Run Test">SampleTests</lineMarker> {
@Test
fun <lineMarker descr="Run Test">testMe</lineMarker>() {
assertTrue(Sample().checkMe() > 0)
}
}
@@ -0,0 +1,9 @@
package sample
actual class <lineMarker descr="Has declaration in common module">Sample</lineMarker> {
actual fun <lineMarker descr="Has declaration in common module">checkMe</lineMarker>() = 12
}
actual object <lineMarker descr="Has declaration in common module">Platform</lineMarker> {
actual val <lineMarker descr="Has declaration in common module">name</lineMarker>: String = "JS"
}
@@ -0,0 +1,9 @@
package sample
actual class <lineMarker descr="Has declaration in common module">Sample</lineMarker> {
actual fun <lineMarker descr="Has declaration in common module">checkMe</lineMarker>() = 42
}
actual object <lineMarker descr="Has declaration in common module">Platform</lineMarker> {
actual val <lineMarker descr="Has declaration in common module">name</lineMarker>: String = "JVM"
}
@@ -0,0 +1,11 @@
package sample
import kotlin.test.Test
import kotlin.test.assertTrue
class <lineMarker descr="Run Test">SampleTestsJVM</lineMarker> {
@Test
fun <lineMarker descr="Run Test">testHello</lineMarker>() {
assertTrue("JVM" in hello())
}
}
@@ -0,0 +1,59 @@
plugins {
id 'org.jetbrains.kotlin.multiplatform' version '{{kotlin_plugin_version}}'
}
repositories {
mavenCentral()
}
group 'com.example'
version '0.0.1'
apply plugin: 'maven-publish'
kotlin {
jvm()
js {
browser {
}
nodejs {
}
}
sourceSets {
commonMain {
dependencies {
implementation kotlin('stdlib-common')
}
}
commonTest {
dependencies {
implementation kotlin('test-common')
implementation kotlin('test-annotations-common')
}
}
jvmMain {
dependencies {
implementation kotlin('stdlib-jdk8')
}
}
jvmTest {
dependencies {
implementation kotlin('test')
implementation kotlin('test-junit')
}
}
jsMain {
dependencies {
implementation kotlin('stdlib-js')
}
}
jsTest {
dependencies {
implementation kotlin('test-js')
}
}
mingwMain {
}
mingwTest {
}
}
}
@@ -0,0 +1 @@
kotlin.code.style=official
@@ -0,0 +1,3 @@
rootProject.name = 'mppLibrary'
enableFeaturePreview('GRADLE_METADATA')
@@ -0,0 +1,4 @@
package sample
fun common(): Boolean {
return <error descr="[TYPE_MISMATCH] Type mismatch: inferred type is String but Boolean was expected">""</error>
}
@@ -0,0 +1,5 @@
package sample
fun js() {
println(common())
}
@@ -0,0 +1,6 @@
package sample
fun jvm() {
println(common())
println(<error descr="[UNRESOLVED_REFERENCE] Unresolved reference: js">js</error>())
}