[JS IR] Add test for enum exportness

^KT-44494 fixed
This commit is contained in:
Ilya Goncharov
2021-10-21 15:24:15 +03:00
committed by Space
parent 41aa0a7c7f
commit 196dc6b071
3 changed files with 44 additions and 0 deletions
+34
View File
@@ -0,0 +1,34 @@
// IGNORE_BACKEND: JS
// RUN_PLAIN_BOX_FUNCTION
// INFER_MAIN_MODULE
// MODULE: export-enum-class
// FILE: lib.kt
@JsExport
enum class Foo {
A,
B;
val foo = ordinal
fun bar() = name
companion object {
val baz = "baz"
}
}
// FILE: test.js
function box() {
if (this["export-enum-class"].Foo.A !== this["export-enum-class"].Foo.A) return "fail1"
if (this["export-enum-class"].Foo.B !== this["export-enum-class"].Foo.B) return "fail2"
if (this["export-enum-class"].Foo.Companion.baz !== "baz") return "fail3"
if (this["export-enum-class"].Foo.A.foo !== 0) return "fail4"
if (this["export-enum-class"].Foo.B.foo !== 1) return "fail5"
if (this["export-enum-class"].Foo.A.bar() !== "A") return "fail6"
if (this["export-enum-class"].Foo.B.bar() !== "B") return "fail7"
}