From cd1296309f170149548d4407a885db89483b5174 Mon Sep 17 00:00:00 2001 From: Ilya Goncharov Date: Thu, 21 Oct 2021 19:17:34 +0300 Subject: [PATCH] [JS IR] Add constructor parameter to test and values, valueOf methods ^KT-37916 fixed ^KT-44494 fixed --- .../testData/box/export/exportEnumClass.kt | 29 ++++++++++++------- 1 file changed, 19 insertions(+), 10 deletions(-) diff --git a/js/js.translator/testData/box/export/exportEnumClass.kt b/js/js.translator/testData/box/export/exportEnumClass.kt index 4a2c38e512d..8d7ce9778b5 100644 --- a/js/js.translator/testData/box/export/exportEnumClass.kt +++ b/js/js.translator/testData/box/export/exportEnumClass.kt @@ -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" } \ No newline at end of file