[JS IR] Add constructor parameter to test and values, valueOf methods
^KT-37916 fixed ^KT-44494 fixed
This commit is contained in:
+19
-10
@@ -6,9 +6,9 @@
|
||||
// FILE: lib.kt
|
||||
|
||||
@JsExport
|
||||
enum class Foo {
|
||||
A,
|
||||
B;
|
||||
enum class Foo(val constructorParameter: String) {
|
||||
A("aConstructorParameter"),
|
||||
B("bConstructorParameter");
|
||||
|
||||
val foo = ordinal
|
||||
|
||||
@@ -54,16 +54,25 @@ function box() {
|
||||
if (this["export-enum-class"].Foo.A.bay() !== "A") return "fail8"
|
||||
if (this["export-enum-class"].Foo.B.bay() !== "B") return "fail9"
|
||||
|
||||
if (this["export-enum-class"].Bar.A.foo !== 0) return "fail10"
|
||||
if (this["export-enum-class"].Bar.B.foo !== 1) return "fail11"
|
||||
if (this["export-enum-class"].Foo.A.constructorParameter !== "aConstructorParameter") return "fail10"
|
||||
if (this["export-enum-class"].Foo.B.constructorParameter !== "bConstructorParameter") return "fail11"
|
||||
|
||||
if (this["export-enum-class"].Bar.A.bar("A") !== "A") return "fail12"
|
||||
if (this["export-enum-class"].Bar.B.bar("B") !== "B") return "fail13"
|
||||
if (this["export-enum-class"].Bar.A.foo !== 0) return "fail12"
|
||||
if (this["export-enum-class"].Bar.B.foo !== 1) return "fail13"
|
||||
|
||||
if (this["export-enum-class"].Bar.A.bay() !== "A") return "fail14"
|
||||
if (this["export-enum-class"].Bar.B.bay() !== "B") return "fail15"
|
||||
if (this["export-enum-class"].Bar.A.bar("A") !== "A") return "fail14"
|
||||
if (this["export-enum-class"].Bar.B.bar("B") !== "B") return "fail15"
|
||||
|
||||
if (this["export-enum-class"].Bar.B.constructor.prototype.hasOwnProperty('baz')) return "fail16"
|
||||
if (this["export-enum-class"].Bar.A.bay() !== "A") return "fail15"
|
||||
if (this["export-enum-class"].Bar.B.bay() !== "B") return "fail16"
|
||||
|
||||
if (this["export-enum-class"].Bar.B.constructor.prototype.hasOwnProperty('baz')) return "fail17"
|
||||
|
||||
if (this["export-enum-class"].Foo.valueOf("A") !== this["export-enum-class"].Foo.A) return "fail18"
|
||||
if (this["export-enum-class"].Foo.valueOf("B") !== this["export-enum-class"].Foo.B) return "fail19"
|
||||
|
||||
if (this["export-enum-class"].Foo.values().indexOf(this["export-enum-class"].Foo.A) === -1) return "fail20"
|
||||
if (this["export-enum-class"].Foo.values().indexOf(this["export-enum-class"].Foo.B) === -1) return "fail21"
|
||||
|
||||
return "OK"
|
||||
}
|
||||
Reference in New Issue
Block a user