RegressionTests__JavaScriptTests.st
changeset 1004 9021e9f5967b
parent 1003 0a8da511c390
child 1005 7359ab263818
--- a/RegressionTests__JavaScriptTests.st	Wed Oct 30 12:56:52 2013 +0100
+++ b/RegressionTests__JavaScriptTests.st	Wed Oct 30 13:06:30 2013 +0100
@@ -1230,6 +1230,40 @@
     "
 !
 
+testForIn03
+    |output|
+
+    JavaScriptParser forInAllowed ifFalse:[^ self].
+
+    output := '' writeStream.
+    self 
+        execute:'test(arg, output) {
+                    var sum = 0;
+
+                    for (var el in arg) {
+                        output.showCR(el*el);
+                        if (el == 1) continue;
+                        sum += el;
+                        if (el == 2) break;
+                    }
+                    return sum;    
+                 }'
+        for:nil
+        arguments:( Array with:#(1 2 3) with:output)
+        expect:2.
+
+    self assert:(output contents asCollectionOfLinesWithReturn asArray = #( 
+        '1'
+        '4'
+        '9'
+       ))
+
+    "
+     self run:#testForIn01
+     self new testForIn01  
+    "
+!
+
 testIf01
     self 
         execute:'max(a, b) {