OLD | NEW |
---|---|
(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 } | |
OLD | NEW |