From 17ebb3612893b37c74be9bb34066547c7787cade Mon Sep 17 00:00:00 2001 From: Ilya Gorbunov Date: Wed, 3 Feb 2016 21:34:08 +0300 Subject: [PATCH] Test Throwable properties in JS, don't work as expected, commiting as ignored. #KT-10911 --- .../test/semantics/StandardClassesTest.java | 4 ++++ .../standardClasses/cases/throwableImpl.kt | 23 +++++++++++++++++++ 2 files changed, 27 insertions(+) create mode 100644 js/js.translator/testData/standardClasses/cases/throwableImpl.kt diff --git a/js/js.tests/test/org/jetbrains/kotlin/js/test/semantics/StandardClassesTest.java b/js/js.tests/test/org/jetbrains/kotlin/js/test/semantics/StandardClassesTest.java index dc549476250..1ae7d6a7d34 100644 --- a/js/js.tests/test/org/jetbrains/kotlin/js/test/semantics/StandardClassesTest.java +++ b/js/js.tests/test/org/jetbrains/kotlin/js/test/semantics/StandardClassesTest.java @@ -74,4 +74,8 @@ public final class StandardClassesTest extends SingleFileTranslationTest { public void testHashMapTypeOfElement() throws Exception { checkFooBoxIsOk(); } + + public void ignore_testThrowableImpl() throws Exception { + checkFooBoxIsOk(); + } } diff --git a/js/js.translator/testData/standardClasses/cases/throwableImpl.kt b/js/js.translator/testData/standardClasses/cases/throwableImpl.kt new file mode 100644 index 00000000000..ecc6fee774d --- /dev/null +++ b/js/js.translator/testData/standardClasses/cases/throwableImpl.kt @@ -0,0 +1,23 @@ +package foo + +class MyThrowable(message: String? = null) : java.lang.Exception(message) { + + override val message: String? + get() = "My message: " + super.message + + override val cause: Throwable? + get() = super.cause ?: this + +} + +fun box(): String { + try { + throw MyThrowable("test") + } catch (t: MyThrowable) { + if (t.cause != t) return "fail t.cause" + if (t.message != "My message: test") return "fail t.message" + return "OK" + } + + return "fail: MyThrowable wasn't catched." +}