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

Unified Diff: test/mjsunit/es6/object-tostring.js

Issue 546803003: Update ObjectToString to Harmony-draft algorithm (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Use intern'd strings instead of creating vectors Created 6 years, 2 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
Index: test/mjsunit/es6/object-tostring.js
diff --git a/test/mjsunit/es6/object-tostring.js b/test/mjsunit/es6/object-tostring.js
new file mode 100644
index 0000000000000000000000000000000000000000..e609b571c896189bd6be4028e11d662869401819
--- /dev/null
+++ b/test/mjsunit/es6/object-tostring.js
@@ -0,0 +1,35 @@
+// Copyright 2014 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Flags: --harmony-tostring
+
+// TODO: Move duplicated tests into mjsunit/class-of-builtins.js
Dmitry Lomov (no reviews) 2014/10/18 15:16:48 Nit: I volunteer to own this TODO, so add me to th
+var funs = {
+ Object: [ Object ],
+/* Function: [ Function ],
Dmitry Lomov (no reviews) 2014/10/18 15:16:48 Why all these tests are commented out?
+ Array: [ Array ],
+ String: [ String ],
+ Boolean: [ Boolean ],
+ Number: [ Number ],
+ Date: [ Date ],
+ RegExp: [ RegExp ],
+ Error: [ Error, TypeError, RangeError, SyntaxError, ReferenceError, EvalError, URIError ]*/
+}
+for (f in funs) {
+ for (i in funs[f]) {
+ assertEquals("[object " + f + "]",
+ Object.prototype.toString.call(new funs[f][i]),
+ funs[f][i]);
+ assertEquals("[object Function]",
+ Object.prototype.toString.call(funs[f][i]),
+ funs[f][i]);
+ }
+
+ // Ensure class !== tag
+ var fake = f === "Object" ? [] : {};
+ fake[Symbol.toStringTag] = f;
+ // if tag is "Object", it is not prepended with "~"
+ assertEquals(f === "Object" ? "[object " + f + "]" : "[object ~" + f + "]",
Dmitry Lomov (no reviews) 2014/10/18 15:16:48 Add tests for all cases from 19.1.3.6.
+ Object.prototype.toString.call(fake));
+}

Powered by Google App Engine
This is Rietveld 408576698