From 3e0b50ef6bff8c07b990a37d93d07861c7b0a71d Mon Sep 17 00:00:00 2001 From: Alexander Gorshenev Date: Mon, 13 Nov 2017 14:40:28 +0300 Subject: [PATCH] A test for catch serialization. --- backend.native/tests/build.gradle | 6 ++++++ backend.native/tests/serialization/catch.kt | 13 +++++++++++++ backend.native/tests/serialization/use.kt | 4 ++++ 3 files changed, 23 insertions(+) create mode 100644 backend.native/tests/serialization/catch.kt create mode 100644 backend.native/tests/serialization/use.kt diff --git a/backend.native/tests/build.gradle b/backend.native/tests/build.gradle index 2974f11ad4d..91fd5f1cffc 100644 --- a/backend.native/tests/build.gradle +++ b/backend.native/tests/build.gradle @@ -2047,6 +2047,12 @@ task deserialized_members(type: LinkKonanTest) { source = "serialization/deserialize_members.kt" } +task serialized_catch(type: LinkKonanTest) { + source = "serialization/use.kt" + lib = "serialization/catch.kt" + goldValue = "Gotcha1: XXX\nGotcha2: YYY\n" +} + task testing_annotations(type: RunStandaloneKonanTest) { source = "testing/annotations.kt" flags = ['-tr'] diff --git a/backend.native/tests/serialization/catch.kt b/backend.native/tests/serialization/catch.kt new file mode 100644 index 00000000000..473a3c74fea --- /dev/null +++ b/backend.native/tests/serialization/catch.kt @@ -0,0 +1,13 @@ + +inline fun foo() { + try { + try { + throw Exception("XXX") + } catch (e: Throwable) { + println("Gotcha1: ${e.message}") + throw Exception("YYY") + } + } catch (e: Throwable) { + println("Gotcha2: ${e.message}") + } +} diff --git a/backend.native/tests/serialization/use.kt b/backend.native/tests/serialization/use.kt new file mode 100644 index 00000000000..2029e4ebc87 --- /dev/null +++ b/backend.native/tests/serialization/use.kt @@ -0,0 +1,4 @@ + +fun main(args: Array) { + foo() +}