[ES6] Add @@toStringTag to GeneratorFunction
[WebKit-https.git] / Source / JavaScriptCore / tests / es6 / well-known_symbols_Symbol.toStringTag_new_built-ins.js
1 function test() {
2
3 var passed = true;
4 var s = Symbol.toStringTag;
5 [
6   [String, "String Iterator"],
7   [Array, "Array Iterator"],
8   [Map, "Map Iterator"],
9   [Set, "Set Iterator"]
10 ].forEach(function(pair){
11   var iterProto = Object.getPrototypeOf(new pair[0]()[Symbol.iterator]());
12   passed = passed
13     && iterProto.hasOwnProperty(s)
14     && iterProto[s] === pair[1];
15 });
16
17 passed = passed
18   && Object.getPrototypeOf(function*(){})[s] === "GeneratorFunction"
19   && Object.getPrototypeOf(function*(){}())[s] === "Generator"
20   && Map.prototype[s] === "Map"
21   && Set.prototype[s] === "Set"
22   && ArrayBuffer.prototype[s] === "ArrayBuffer"
23   && DataView.prototype[s] === "DataView"
24   && Promise.prototype[s] === "Promise"
25   && Symbol.prototype[s] === "Symbol"
26   && typeof Object.getOwnPropertyDescriptor(
27     Object.getPrototypeOf(Int8Array).prototype, Symbol.toStringTag).get === "function";
28   return passed;
29 }
30
31 if (!test())
32     throw new Error("Test failed");