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

Unified Diff: test/mjsunit/harmony/to-primitive.js

Issue 1324713002: [es6] Implement Date.prototype[@@toPrimitive] as C++ builtin. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Address Michi's comments. Created 5 years, 4 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/mjsunit/harmony/to-number.js ('k') | test/mjsunit/harmony/to-string.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/mjsunit/harmony/to-primitive.js
diff --git a/test/mjsunit/harmony/to-primitive.js b/test/mjsunit/harmony/to-primitive.js
index 755742519807e5d8039544d2514cf05d8f08737c..09280bf1ee7c426f775679ad2e79224c507ce7a3 100644
--- a/test/mjsunit/harmony/to-primitive.js
+++ b/test/mjsunit/harmony/to-primitive.js
@@ -67,10 +67,6 @@ assertEquals("xyz", %ToPrimitive_String(a));
assertEquals("xyz", %_ToPrimitive(a));
assertEquals("xyz", %_ToPrimitive_Number(a));
assertEquals("xyz", %_ToPrimitive_String(a));
-assertEquals("xyz", %OrdinaryToPrimitive(a, "number"));
-assertEquals("xyz", %OrdinaryToPrimitive(a, "string"));
-assertEquals("xyz", %_OrdinaryToPrimitive(a, "number"));
-assertEquals("xyz", %_OrdinaryToPrimitive(a, "string"));
var b = { valueOf: function() { return 42 }};
assertEquals(42, %ToPrimitive(b));
@@ -79,10 +75,6 @@ assertEquals("[object Object]", %ToPrimitive_String(b));
assertEquals(42, %_ToPrimitive(b));
assertEquals(42, %_ToPrimitive_Number(b));
assertEquals("[object Object]", %_ToPrimitive_String(b));
-assertEquals(42, %OrdinaryToPrimitive(b, "number"));
-assertEquals("[object Object]", %OrdinaryToPrimitive(b, "string"));
-assertEquals(42, %_OrdinaryToPrimitive(b, "number"));
-assertEquals("[object Object]", %_OrdinaryToPrimitive(b, "string"));
var c = {
toString: function() { return "x"},
@@ -94,10 +86,6 @@ assertEquals("x", %ToPrimitive_String(c));
assertEquals(123, %_ToPrimitive(c));
assertEquals(123, %_ToPrimitive_Number(c));
assertEquals("x", %_ToPrimitive_String(c));
-assertEquals(123, %OrdinaryToPrimitive(c, "number"));
-assertEquals("x", %OrdinaryToPrimitive(c, "string"));
-assertEquals(123, %_OrdinaryToPrimitive(c, "number"));
-assertEquals("x", %_OrdinaryToPrimitive(c, "string"));
var d = {
[Symbol.toPrimitive]: function(hint) { return hint }
@@ -108,3 +96,11 @@ assertEquals("string", %ToPrimitive_String(d));
assertEquals("default", %_ToPrimitive(d));
assertEquals("number", %_ToPrimitive_Number(d));
assertEquals("string", %_ToPrimitive_String(d));
+
+var e = new Date(0);
+assertEquals(e.toString(), %ToPrimitive(e));
+assertEquals(0, %ToPrimitive_Number(e));
+assertEquals(e.toString(), %ToPrimitive_String(e));
+assertEquals(e.toString(), %_ToPrimitive(e));
+assertEquals(0, %_ToPrimitive_Number(e));
+assertEquals(e.toString(), %_ToPrimitive_String(e));
« no previous file with comments | « test/mjsunit/harmony/to-number.js ('k') | test/mjsunit/harmony/to-string.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698