diff --git a/js/js.tests/test/org/jetbrains/k2js/test/semantics/ForeachTest.java b/js/js.tests/test/org/jetbrains/k2js/test/semantics/ForeachTest.java index 0d8fe7247ff..9c59d9c417c 100644 --- a/js/js.tests/test/org/jetbrains/k2js/test/semantics/ForeachTest.java +++ b/js/js.tests/test/org/jetbrains/k2js/test/semantics/ForeachTest.java @@ -25,6 +25,10 @@ public final class ForeachTest extends AbstractExpressionTest { super("for/"); } + public void TODO_testForUpTo() throws Exception { + fooBoxIsValue(10); + } + public void testForIteratesOverArray() throws Exception { fooBoxTest(); } diff --git a/js/js.translator/testFiles/expression/for/cases/forUpTo.kt b/js/js.translator/testFiles/expression/for/cases/forUpTo.kt new file mode 100644 index 00000000000..ed3692a21a1 --- /dev/null +++ b/js/js.translator/testFiles/expression/for/cases/forUpTo.kt @@ -0,0 +1,9 @@ +package foo + +fun box() : Int { + var sum = 0 + for (i in 0.upto(5)) { + sum += i + } + return sum +} \ No newline at end of file diff --git a/js/js.translator/testFiles/kotlin_lib.js b/js/js.translator/testFiles/kotlin_lib.js index 3e3676b9b03..899d6e2dcea 100644 --- a/js/js.translator/testFiles/kotlin_lib.js +++ b/js/js.translator/testFiles/kotlin_lib.js @@ -41,6 +41,10 @@ var kotlin = {set:function (receiver, key, value) { return answer; }; + Kotlin.upto = function (from, limit, reversed) { + return Kotlin.$new(Kotlin.NumberRange)(from, limit - from, reversed).iterator(); + }; + Kotlin.modules = {}; Kotlin.Exceptions = {}; Kotlin.Exception = Kotlin.$createClass();