mirror of https://github.com/tc39/test262.git
Object.prototype.toString: improve coverage
This commit is contained in:
parent
45d52b90ee
commit
e0436fc52d
|
@ -11,7 +11,7 @@ info: |
|
|||
15. Let tag be ? Get(O, @@toStringTag).
|
||||
16. If Type(tag) is not String, set tag to builtinTag.
|
||||
17. Return the string-concatenation of "[object ", tag, and "]".
|
||||
features: [Symbol.toStringTag, Symbol.iterator]
|
||||
features: [Symbol.toStringTag, Symbol.iterator, iterator-helpers]
|
||||
---*/
|
||||
|
||||
var toString = Object.prototype.toString;
|
||||
|
@ -23,3 +23,6 @@ assert.sameValue(toString.call(arrIter), '[object Array Iterator]');
|
|||
|
||||
Object.defineProperty(arrIterProto, Symbol.toStringTag, {configurable: true, value: null});
|
||||
assert.sameValue(toString.call(arrIter), '[object Object]');
|
||||
|
||||
delete arrIterProto[Symbol.toStringTag];
|
||||
assert.sameValue(toString.call(arrIter), '[object Iterator]');
|
||||
|
|
|
@ -11,7 +11,7 @@ info: |
|
|||
15. Let tag be ? Get(O, @@toStringTag).
|
||||
16. If Type(tag) is not String, set tag to builtinTag.
|
||||
17. Return the string-concatenation of "[object ", tag, and "]".
|
||||
features: [Symbol.toStringTag, Symbol.iterator, generators]
|
||||
features: [Symbol.toStringTag, Symbol.iterator, generators, iterator-helpers]
|
||||
---*/
|
||||
|
||||
var toString = Object.prototype.toString;
|
||||
|
@ -28,3 +28,6 @@ Object.defineProperty(genProto, Symbol.toStringTag, {
|
|||
get: function() { return {}; },
|
||||
});
|
||||
assert.sameValue(toString.call(gen), '[object Object]');
|
||||
|
||||
delete genProto[Symbol.toStringTag];
|
||||
assert.sameValue(toString.call(gen), '[object Iterator]');
|
||||
|
|
|
@ -11,7 +11,7 @@ info: |
|
|||
15. Let tag be ? Get(O, @@toStringTag).
|
||||
16. If Type(tag) is not String, set tag to builtinTag.
|
||||
17. Return the string-concatenation of "[object ", tag, and "]".
|
||||
features: [Symbol.toStringTag, Symbol.iterator, Map]
|
||||
features: [Symbol.toStringTag, Symbol.iterator, Map, iterator-helpers]
|
||||
---*/
|
||||
|
||||
var toString = Object.prototype.toString;
|
||||
|
@ -28,3 +28,6 @@ Object.defineProperty(mapIterProto, Symbol.toStringTag, {
|
|||
get: function() { return new String('ShouldNotBeUnwrapped'); },
|
||||
});
|
||||
assert.sameValue(toString.call(mapIter), '[object Object]');
|
||||
|
||||
delete mapIterProto[Symbol.toStringTag];
|
||||
assert.sameValue(toString.call(mapIter), '[object Iterator]');
|
||||
|
|
|
@ -18,3 +18,6 @@ var toString = Object.prototype.toString;
|
|||
|
||||
var promise = new Promise(function () {});
|
||||
assert.sameValue(toString.call(promise), '[object Promise]');
|
||||
|
||||
delete Promise.prototype[Symbol.toStringTag];
|
||||
assert.sameValue(toString.call(promise), '[object Object]');
|
||||
|
|
|
@ -11,7 +11,7 @@ info: |
|
|||
15. Let tag be ? Get(O, @@toStringTag).
|
||||
16. If Type(tag) is not String, set tag to builtinTag.
|
||||
17. Return the string-concatenation of "[object ", tag, and "]".
|
||||
features: [Symbol.toStringTag, Symbol.iterator, Set]
|
||||
features: [Symbol.toStringTag, Symbol.iterator, Set, iterator-helpers]
|
||||
---*/
|
||||
|
||||
var toString = Object.prototype.toString;
|
||||
|
@ -28,3 +28,6 @@ Object.defineProperty(setIterProto, Symbol.toStringTag, {
|
|||
get: function() { return new String('ShouldNotBeUnwrapped'); },
|
||||
});
|
||||
assert.sameValue(toString.call(setIter), '[object Object]');
|
||||
|
||||
delete setIterProto[Symbol.toStringTag];
|
||||
assert.sameValue(toString.call(setIter), '[object Iterator]');
|
||||
|
|
|
@ -11,7 +11,7 @@ info: |
|
|||
15. Let tag be ? Get(O, @@toStringTag).
|
||||
16. If Type(tag) is not String, set tag to builtinTag.
|
||||
17. Return the string-concatenation of "[object ", tag, and "]".
|
||||
features: [Symbol.toStringTag, Symbol.iterator]
|
||||
features: [Symbol.toStringTag, Symbol.iterator, iterator-helpers]
|
||||
---*/
|
||||
|
||||
var toString = Object.prototype.toString;
|
||||
|
@ -26,3 +26,6 @@ Object.defineProperty(strIterProto, Symbol.toStringTag, {
|
|||
get: function() { return new String('ShouldNotBeUnwrapped'); },
|
||||
});
|
||||
assert.sameValue(toString.call(strIter), '[object Object]');
|
||||
|
||||
delete strIterProto[Symbol.toStringTag];
|
||||
assert.sameValue(toString.call(strIter), '[object Iterator]');
|
||||
|
|
|
@ -18,4 +18,4 @@ var toString = Object.prototype.toString;
|
|||
|
||||
var wm = new WeakMap();
|
||||
delete WeakMap.prototype[Symbol.toStringTag];
|
||||
assert.sameValue(toString.call(wm), '[object Object]');
|
||||
assert.sameValue(toString.call(wm), '[object Object]');
|
||||
|
|
|
@ -18,4 +18,4 @@ var toString = Object.prototype.toString;
|
|||
|
||||
var wm = new WeakSet();
|
||||
delete WeakSet.prototype[Symbol.toStringTag];
|
||||
assert.sameValue(toString.call(wm), '[object Object]');
|
||||
assert.sameValue(toString.call(wm), '[object Object]');
|
||||
|
|
Loading…
Reference in New Issue