From 865880f196e51d22f992ed73414f14441e21ac37 Mon Sep 17 00:00:00 2001 From: Zalim Bashorov Date: Wed, 18 Jun 2014 23:18:23 +0400 Subject: [PATCH] Minor in JS backend: added missed test case -- `when` inside `when` w/o braces. --- .../test/semantics/PatternMatchingTest.java | 6 ++++- .../cases/whenWithOneStmWhen.kt | 22 +++++++++++++++++++ 2 files changed, 27 insertions(+), 1 deletion(-) create mode 100644 js/js.translator/testData/patternMatching/cases/whenWithOneStmWhen.kt diff --git a/js/js.tests/test/org/jetbrains/k2js/test/semantics/PatternMatchingTest.java b/js/js.tests/test/org/jetbrains/k2js/test/semantics/PatternMatchingTest.java index 755dce1002d..3622d42865b 100644 --- a/js/js.tests/test/org/jetbrains/k2js/test/semantics/PatternMatchingTest.java +++ b/js/js.tests/test/org/jetbrains/k2js/test/semantics/PatternMatchingTest.java @@ -105,4 +105,8 @@ public final class PatternMatchingTest extends SingleFileTranslationTest { public void testIfWithOneStmWhen() throws Exception { fooBoxTest(); } -} \ No newline at end of file + + public void testWhenWithOneStmWhen() throws Exception { + fooBoxTest(); + } +} diff --git a/js/js.translator/testData/patternMatching/cases/whenWithOneStmWhen.kt b/js/js.translator/testData/patternMatching/cases/whenWithOneStmWhen.kt new file mode 100644 index 00000000000..04e043ece8a --- /dev/null +++ b/js/js.translator/testData/patternMatching/cases/whenWithOneStmWhen.kt @@ -0,0 +1,22 @@ +package foo + + +fun box(): Boolean { + var result = false + val i = 1 + when (i) { + 1 -> + when (i) { + 1 -> result = true + else -> result = false + } + + else -> + when (i) { + 1 -> result = true + else -> result = false + } + } + + return result; +}