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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright 2014 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 // Flags: --harmony-tostring
6
7 // 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
8 var funs = {
9 Object: [ Object ],
10 /* Function: [ Function ],
Dmitry Lomov (no reviews) 2014/10/18 15:16:48 Why all these tests are commented out?
11 Array: [ Array ],
12 String: [ String ],
13 Boolean: [ Boolean ],
14 Number: [ Number ],
15 Date: [ Date ],
16 RegExp: [ RegExp ],
17 Error: [ Error, TypeError, RangeError, SyntaxError, ReferenceError, EvalErr or, URIError ]*/
18 }
19 for (f in funs) {
20 for (i in funs[f]) {
21 assertEquals("[object " + f + "]",
22 Object.prototype.toString.call(new funs[f][i]),
23 funs[f][i]);
24 assertEquals("[object Function]",
25 Object.prototype.toString.call(funs[f][i]),
26 funs[f][i]);
27 }
28
29 // Ensure class !== tag
30 var fake = f === "Object" ? [] : {};
31 fake[Symbol.toStringTag] = f;
32 // if tag is "Object", it is not prepended with "~"
33 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.
34 Object.prototype.toString.call(fake));
35 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698