blob: a15603e66a1d6489044678cb86ba04f993a7aff4 [file] [log] [blame]
description(
"This tests that ToString(Symbol) behaviors."
);
shouldBeEqualToString("String(Symbol.iterator)", "Symbol(Symbol.iterator)");
shouldThrow("String(Symbol.prototype)", `"TypeError: Symbol.prototype.valueOf requires that |this| be a symbol or a symbol object"`);
shouldBeEqualToString("Symbol.prototype.toString.call(Symbol.iterator)", "Symbol(Symbol.iterator)");
shouldBeEqualToString("Symbol.prototype.toString.call(Symbol('hello'))", "Symbol(hello)");
shouldBeEqualToString("Symbol.prototype.toString.call(Symbol())", "Symbol()");
shouldBeEqualToString("Object.prototype.toString.call(Symbol())", "[object Symbol]");
shouldBeEqualToString("Object.prototype.toString.call(Symbol.prototype)", "[object Symbol]");
shouldBeEqualToString("Object.prototype.toString.call(Symbol)", "[object Function]");
successfullyParsed = true;