JPS, -Xcommon-sources: write tests

This commit is contained in:
Sergey Rostov
2018-09-10 15:14:45 +03:00
parent 313c27859a
commit c8351c3da0
12 changed files with 107 additions and 0 deletions

View File

@@ -0,0 +1,7 @@
c [sourceSetHolder]
pJvm [compilationAndSourceSetHolder, jvm]
pJvm -> c [include]
pJs [compilationAndSourceSetHolder, js]
pJs -> c [include]

View File

@@ -0,0 +1,5 @@
use @Optional in JS
remove @Optional from JS
use @Optional in JVM
remove @Optional from JVM
add another @Optional in Common module

View File

@@ -0,0 +1,62 @@
================ Step #1 use @Optional in JS =================
Building c
Building pJs
Compiling files:
pJs/src/c.kt
End of files
Exit code: ABORT
------------------------------------------
COMPILATION FAILED
Declaration annotated with '@OptionalExpectation' can only be used in common module sources
================ Step #2 remove @Optional from JS =================
Building c
Building pJs
Exit code: NOTHING_DONE
------------------------------------------
Building pJvm
Exit code: NOTHING_DONE
------------------------------------------
================ Step #3 use @Optional in JVM =================
Building c
Building pJs
Exit code: NOTHING_DONE
------------------------------------------
Building pJvm
Compiling files:
pJvm/src/c.kt
End of files
Exit code: ABORT
------------------------------------------
COMPILATION FAILED
Declaration annotated with '@OptionalExpectation' can only be used in common module sources
================ Step #4 remove @Optional from JVM =================
Building c
Building pJs
Exit code: NOTHING_DONE
------------------------------------------
Building pJvm
Exit code: NOTHING_DONE
------------------------------------------
================ Step #5 add another @Optional in Common module =================
Building c
Building pJs
Compiling files:
c/src/b.kt
End of files
Exit code: OK
------------------------------------------
Building pJvm
Compiling files:
c/src/b.kt
End of files
Exit code: OK
------------------------------------------

View File

@@ -0,0 +1,7 @@
@file:Suppress("EXPERIMENTAL_API_USAGE_ERROR")
@OptionalExpectation
expect annotation class Optional(val value: String)
@Optional("Foo")
class Foo

View File

@@ -0,0 +1,2 @@
@Optional("Foo")
class Bar

View File

@@ -0,0 +1,3 @@
// Should be an error: Declaration annotated with '@OptionalExpectation' can only be used in common module sources
@Optional("BarJs")
class BarJs

View File

@@ -0,0 +1,3 @@
// Should be an error: Declaration annotated with '@OptionalExpectation' can only be used in common module sources
@Optional("BarJvm")
class BarJvm