Index: test/mjsunit/harmony/iteration-syntax.js |
diff --git a/test/mjsunit/regress/regress-2489.js b/test/mjsunit/harmony/iteration-syntax.js |
similarity index 52% |
copy from test/mjsunit/regress/regress-2489.js |
copy to test/mjsunit/harmony/iteration-syntax.js |
index 882c4f794a88e24d1d64e86a466b27c39f51e625..21149c04bc99108beb802fcfd65a253a558aae42 100644 |
--- a/test/mjsunit/regress/regress-2489.js |
+++ b/test/mjsunit/harmony/iteration-syntax.js |
@@ -25,26 +25,41 @@ |
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
-// Flags: --allow-natives-syntax |
+// Flags: --harmony-iteration --harmony-scoping |
+ |
+// Test for-of syntax. |
"use strict"; |
-function f(a, b) { |
- return g("c", "d"); |
-} |
- |
-function g(a, b) { |
- g.constructor.apply(this, arguments); |
-} |
- |
-g.constructor = function(a, b) { |
- assertEquals("c", a); |
- assertEquals("d", b); |
-} |
- |
-f("a", "b"); |
-f("a", "b"); |
-%OptimizeFunctionOnNextCall(f); |
-f("a", "b"); |
-g.x = "deopt"; |
-f("a", "b"); |
+function f() { for (x of y) { } } |
+function f() { for (var x of y) { } } |
+function f() { for (let x of y) { } } |
+ |
+assertThrows("function f() { for (x of) { } }", SyntaxError); |
+assertThrows("function f() { for (x of y z) { } }", SyntaxError); |
+assertThrows("function f() { for (x of y;) { } }", SyntaxError); |
+ |
+assertThrows("function f() { for (var x of) { } }", SyntaxError); |
+assertThrows("function f() { for (var x of y z) { } }", SyntaxError); |
+assertThrows("function f() { for (var x of y;) { } }", SyntaxError); |
+ |
+assertThrows("function f() { for (let x of) { } }", SyntaxError); |
+assertThrows("function f() { for (let x of y z) { } }", SyntaxError); |
+assertThrows("function f() { for (let x of y;) { } }", SyntaxError); |
+ |
+assertThrows("function f() { for (of y) { } }", SyntaxError); |
+assertThrows("function f() { for (of of) { } }", SyntaxError); |
+assertThrows("function f() { for (var of y) { } }", SyntaxError); |
+assertThrows("function f() { for (var of of) { } }", SyntaxError); |
+assertThrows("function f() { for (let of y) { } }", SyntaxError); |
+assertThrows("function f() { for (let of of) { } }", SyntaxError); |
+ |
+// Alack, this appears to be valid. |
+function f() { for (of of y) { } } |
+function f() { for (let of of y) { } } |
+function f() { for (var of of y) { } } |
+ |
+// This too, of course. |
+function f() { for (of in y) { } } |
+function f() { for (var of in y) { } } |
+function f() { for (let of in y) { } } |