rra/ilgonmic/more-tests-for-internal-export
[JS IR] Add single file test [JS IR] isExportedMember considers only public API [JS IR] Add case with non default accessor Merge-request: KT-MR-6008 Merged-by: Ilya Goncharov <Ilya.Goncharov@jetbrains.com> ^KT-50504 fixed
This commit is contained in:
@@ -2094,6 +2094,12 @@ public class BoxJsTestGenerated extends AbstractBoxJsTest {
|
||||
runTest("js/js.translator/testData/box/export/exportClassWithInternal.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("exportClassWithInternalOneFile.kt")
|
||||
public void testExportClassWithInternalOneFile() throws Exception {
|
||||
runTest("js/js.translator/testData/box/export/exportClassWithInternalOneFile.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("exportEnumClass.kt")
|
||||
public void testExportEnumClass() throws Exception {
|
||||
|
||||
+6
@@ -2496,6 +2496,12 @@ public class IrBoxJsTestGenerated extends AbstractIrBoxJsTest {
|
||||
runTest("js/js.translator/testData/box/export/exportClassWithInternal.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("exportClassWithInternalOneFile.kt")
|
||||
public void testExportClassWithInternalOneFile() throws Exception {
|
||||
runTest("js/js.translator/testData/box/export/exportClassWithInternalOneFile.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("exportEnumClass.kt")
|
||||
public void testExportEnumClass() throws Exception {
|
||||
|
||||
@@ -1,11 +1,32 @@
|
||||
// FILE: lib.kt
|
||||
@JsExport
|
||||
class Foo(internal val constructorParameter: String)
|
||||
class Foo(internal val constructorParameter: String) {
|
||||
internal val nonDefaultAccessor: String
|
||||
get() = "hello"
|
||||
|
||||
internal val defaultAccessor: String = constructorParameter + "!"
|
||||
}
|
||||
|
||||
@JsExport
|
||||
enum class Bar(internal val constructorParameter: String) {
|
||||
A("a");
|
||||
|
||||
internal val nonDefaultAccessor: String
|
||||
get() = "hello"
|
||||
|
||||
internal val defaultAccessor: String = constructorParameter + "!"
|
||||
}
|
||||
|
||||
// FILE: main.kt
|
||||
fun box():String {
|
||||
fun box(): String {
|
||||
val foo = Foo("foo")
|
||||
if (foo.constructorParameter != "foo") return "fail"
|
||||
if (foo.constructorParameter != "foo") return "fail1"
|
||||
if (foo.nonDefaultAccessor != "hello") return "fail2"
|
||||
if (foo.defaultAccessor != "foo!") return "fail3"
|
||||
|
||||
if (Bar.A.constructorParameter != "a") return "fail4"
|
||||
if (Bar.A.nonDefaultAccessor != "hello") return "fail5"
|
||||
if (Bar.A.defaultAccessor != "a!") return "fail6"
|
||||
|
||||
return "OK"
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
@JsExport
|
||||
class Foo(internal val constructorParameter: String) {
|
||||
internal val nonDefaultAccessor: String
|
||||
get() = "hello"
|
||||
|
||||
internal val defaultAccessor: String = constructorParameter + "!"
|
||||
}
|
||||
|
||||
@JsExport
|
||||
enum class Bar(internal val constructorParameter: String) {
|
||||
A("a");
|
||||
|
||||
internal val nonDefaultAccessor: String
|
||||
get() = "hello"
|
||||
|
||||
internal val defaultAccessor: String = constructorParameter + "!"
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
val foo = Foo("foo")
|
||||
if (foo.constructorParameter != "foo") return "fail1"
|
||||
if (foo.nonDefaultAccessor != "hello") return "fail2"
|
||||
if (foo.defaultAccessor != "foo!") return "fail3"
|
||||
|
||||
if (Bar.A.constructorParameter != "a") return "fail4"
|
||||
if (Bar.A.nonDefaultAccessor != "hello") return "fail5"
|
||||
if (Bar.A.defaultAccessor != "a!") return "fail6"
|
||||
|
||||
return "OK"
|
||||
}
|
||||
Reference in New Issue
Block a user