mirror of https://github.com/tc39/test262.git
Fix symbol-tag-generators-builtin.js
Two issues: 1. There was a typo, the first `gen` should have been `genFn`. 2. And the last `toString` result should be `'[object Generator]'`, because `Object.getPrototypeOf(gen) == genFn.prototype`. And the `@@toStringTag` property of `genFn.prototype` is inherited from `Generator.prototype[@@toStringTag]`. That also means the "iterator-helpers" flag isn't needed for this test.
This commit is contained in:
parent
bf527dfa49
commit
f0c16faee2
|
@ -11,18 +11,20 @@ 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, iterator-helpers]
|
||||
features: [Symbol.toStringTag, Symbol.iterator, generators]
|
||||
---*/
|
||||
|
||||
var toString = Object.prototype.toString;
|
||||
|
||||
var genFn = function* () {};
|
||||
assert.sameValue(toString.call(gen), '[object GeneratorFunction]');
|
||||
assert.sameValue(toString.call(genFn), '[object GeneratorFunction]');
|
||||
|
||||
var gen = genFn();
|
||||
assert.sameValue(toString.call(gen), '[object Generator]');
|
||||
|
||||
var genProto = Object.getPrototypeOf(gen);
|
||||
assert.sameValue(genProto, genFn.prototype);
|
||||
|
||||
Object.defineProperty(genProto, Symbol.toStringTag, {
|
||||
configurable: true,
|
||||
get: function() { return {}; },
|
||||
|
@ -30,4 +32,4 @@ Object.defineProperty(genProto, Symbol.toStringTag, {
|
|||
assert.sameValue(toString.call(gen), '[object Object]');
|
||||
|
||||
delete genProto[Symbol.toStringTag];
|
||||
assert.sameValue(toString.call(gen), '[object Iterator]');
|
||||
assert.sameValue(toString.call(gen), '[object Generator]');
|
||||
|
|
Loading…
Reference in New Issue