| 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
|
| +var funs = {
|
| + Object: [ Object ],
|
| +/* Function: [ Function ],
|
| + 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 + "]",
|
| + Object.prototype.toString.call(fake));
|
| +}
|
|
|