Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(10)

Unified Diff: test/mjsunit/strict-mode.js

Issue 6698015: Implement strict mode arguments caller/callee. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Kevin's feedback. Created 9 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « test/es5conform/es5conform.status ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/mjsunit/strict-mode.js
diff --git a/test/mjsunit/strict-mode.js b/test/mjsunit/strict-mode.js
index a0320c065212378e2e9472853daa1b2daaa44769..f871430232901b010c3e82e836e53e952d06f75f 100644
--- a/test/mjsunit/strict-mode.js
+++ b/test/mjsunit/strict-mode.js
@@ -978,20 +978,7 @@ repeat(10, function() { testAssignToUndefined(false); });
})();
-(function TestStrictFunctionPills() {
- function strict() {
- "use strict";
- }
- assertThrows(function() { strict.caller; }, TypeError);
- assertThrows(function() { strict.arguments; }, TypeError);
-
- var another = new Function("'use strict'");
- assertThrows(function() { another.caller; }, TypeError);
- assertThrows(function() { another.arguments; }, TypeError);
-
- var third = (function() { "use strict"; return function() {}; })();
- assertThrows(function() { third.caller; }, TypeError);
- assertThrows(function() { third.arguments; }, TypeError);
+function CheckPillDescriptor(func, name) {
function CheckPill(pill) {
assertEquals("function", typeof pill);
@@ -1005,13 +992,28 @@ repeat(10, function() { testAssignToUndefined(false); });
assertFalse(d.enumerable);
}
- function CheckPillDescriptor(func, name) {
- var descriptor = Object.getOwnPropertyDescriptor(func, name);
- CheckPill(descriptor.get)
- CheckPill(descriptor.set);
- assertFalse(descriptor.enumerable);
- assertFalse(descriptor.configurable);
+ var descriptor = Object.getOwnPropertyDescriptor(func, name);
+ CheckPill(descriptor.get)
+ CheckPill(descriptor.set);
+ assertFalse(descriptor.enumerable);
+ assertFalse(descriptor.configurable);
+}
+
+
+(function TestStrictFunctionPills() {
+ function strict() {
+ "use strict";
}
+ assertThrows(function() { strict.caller; }, TypeError);
+ assertThrows(function() { strict.arguments; }, TypeError);
+
+ var another = new Function("'use strict'");
+ assertThrows(function() { another.caller; }, TypeError);
+ assertThrows(function() { another.arguments; }, TypeError);
+
+ var third = (function() { "use strict"; return function() {}; })();
+ assertThrows(function() { third.caller; }, TypeError);
+ assertThrows(function() { third.arguments; }, TypeError);
CheckPillDescriptor(strict, "caller");
CheckPillDescriptor(strict, "arguments");
@@ -1020,3 +1022,41 @@ repeat(10, function() { testAssignToUndefined(false); });
CheckPillDescriptor(third, "caller");
CheckPillDescriptor(third, "arguments");
})();
+
+
+(function TestStrictArgumentPills() {
+ function strict() {
+ "use strict";
+ return arguments;
+ }
+
+ var args = strict();
+ CheckPillDescriptor(args, "caller");
+ CheckPillDescriptor(args, "callee");
+
+ args = strict(17, "value", strict);
+ assertEquals(17, args[0])
+ assertEquals("value", args[1])
+ assertEquals(strict, args[2]);
+ CheckPillDescriptor(args, "caller");
+ CheckPillDescriptor(args, "callee");
+
+ function outer() {
+ "use strict";
+ function inner() {
+ return arguments;
+ }
+ return inner;
+ }
+
+ var args = outer()();
+ CheckPillDescriptor(args, "caller");
+ CheckPillDescriptor(args, "callee");
+
+ args = outer()(17, "value", strict);
+ assertEquals(17, args[0])
+ assertEquals("value", args[1])
+ assertEquals(strict, args[2]);
+ CheckPillDescriptor(args, "caller");
+ CheckPillDescriptor(args, "callee");
+})();
« no previous file with comments | « test/es5conform/es5conform.status ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698