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

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

Issue 6524006: Strict mode function entry (Function.prototype.call/apply) (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Fix presubmit. Created 9 years, 10 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 fead64ad25e053b9d81a9fedec0339b8a17b837e..fbba64ed66606c125dbbec74a5849402c3b41144 100644
--- a/test/mjsunit/strict-mode.js
+++ b/test/mjsunit/strict-mode.js
@@ -436,3 +436,45 @@ repeat(10, function() { testAssignToUndefined(false); });
assertThrows(function() { delete_element(object, 3.14); }, TypeError);
assertEquals(object[3.14], "pi");
})();
+
+// Not transforming this in Function.call and Function.apply.
+(function testThisTransform() {
+ function non_strict() {
+ return this;
+ }
+ function strict() {
+ "use strict";
+ return this;
+ }
+
+ var global_object = (function() { return this; })();
+ var object = {};
+
+ // Non-strict call.
+ assertTrue(non_strict.call(null) === global_object);
+ assertTrue(non_strict.call(undefined) === global_object);
+ assertEquals(typeof non_strict.call(7), "object");
+ assertEquals(typeof non_strict.call("Hello"), "object");
+ assertTrue(non_strict.call(object) === object);
+
+ // Non-strict apply.
+ assertTrue(non_strict.apply(null) === global_object);
+ assertTrue(non_strict.apply(undefined) === global_object);
+ assertEquals(typeof non_strict.apply(7), "object");
+ assertEquals(typeof non_strict.apply("Hello"), "object");
+ assertTrue(non_strict.apply(object) === object);
+
+ // Strict call.
+ assertTrue(strict.call(null) === null);
+ assertTrue(strict.call(undefined) === undefined);
+ assertEquals(typeof strict.call(7), "number");
+ assertEquals(typeof strict.call("Hello"), "string");
+ assertTrue(strict.call(object) === object);
+
+ // Strict apply.
+ assertTrue(strict.apply(null) === null);
+ assertTrue(strict.apply(undefined) === undefined);
+ assertEquals(typeof strict.apply(7), "number");
+ assertEquals(typeof strict.apply("Hello"), "string");
+ assertTrue(strict.apply(object) === object);
+})();
« 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