Index: test/mjsunit/harmony/rest-params.js |
diff --git a/test/mjsunit/harmony/rest-params.js b/test/mjsunit/harmony/rest-params.js |
index fe7ee2adb81186076d1a32bee92642d1a2cdc430..49515f4f2c964678fb61e729ba0012a2edb112c0 100644 |
--- a/test/mjsunit/harmony/rest-params.js |
+++ b/test/mjsunit/harmony/rest-params.js |
@@ -16,18 +16,20 @@ |
return args.length; })(1,2,3,4,5)); |
})(); |
-function strictTest(a, b, ...c) { |
+var strictTest = (function() { |
"use strict"; |
- assertEquals(Array, c.constructor); |
- assertTrue(Array.isArray(c)); |
+ return function strictTest(a, b, ...c) { |
+ assertEquals(Array, c.constructor); |
+ assertTrue(Array.isArray(c)); |
- var expectedLength = arguments.length >= 3 ? arguments.length - 2 : 0; |
- assertEquals(expectedLength, c.length); |
+ var expectedLength = arguments.length >= 3 ? arguments.length - 2 : 0; |
+ assertEquals(expectedLength, c.length); |
- for (var i = 2, j = 0; i < arguments.length; ++i) { |
- assertEquals(c[j++], arguments[i]); |
- } |
-} |
+ for (var i = 2, j = 0; i < arguments.length; ++i) { |
+ assertEquals(c[j++], arguments[i]); |
+ } |
+ }; |
+})(); |
function sloppyTest(a, b, ...c) { |
assertEquals(Array, c.constructor); |
@@ -144,14 +146,15 @@ var O = { |
(function testNoAliasArgumentsStrict() { |
- function strictF(a, ...rest) { |
+ ((function() { |
"use strict"; |
- arguments[0] = 1; |
- assertEquals(3, a); |
- arguments[1] = 2; |
- assertArrayEquals([4, 5], rest); |
- } |
- strictF(3, 4, 5); |
+ return (function strictF(a, ...rest) { |
+ arguments[0] = 1; |
+ assertEquals(3, a); |
+ arguments[1] = 2; |
+ assertArrayEquals([4, 5], rest); |
+ }); |
+ })())(3, 4, 5); |
})(); |
@@ -212,3 +215,21 @@ var O = { |
assertEquals([1, 2, 3], c.child); |
assertEquals([1, 2, 3], c.base); |
})(); |
+ |
+(function TestDirectiveThrows() { |
+ "use strict"; |
+ |
+ assertThrows( |
+ function(){ eval("function(...rest){'use strict';}") }, SyntaxError); |
+ assertThrows(function(){ eval("(...rest) => {'use strict';}") }, SyntaxError); |
+ assertThrows( |
+ function(){ eval("(class{foo(...rest) {'use strict';}});") }, SyntaxError); |
+ |
+ assertThrows( |
+ function(){ eval("function(a, ...rest){'use strict';}") }, SyntaxError); |
+ assertThrows( |
+ function(){ eval("(a, ...rest) => {'use strict';}") }, SyntaxError); |
+ assertThrows( |
+ function(){ eval("(class{foo(a, ...rest) {'use strict';}});") }, |
+ SyntaxError); |
+})(); |