Simplify toString (#4441)

* Assume Symbol exists in toString tests

* Use native array map instead of custom one in toString

* Assume Symbol.prototype.toString exists in toString
This commit is contained in:
Luiz Américo
2019-08-25 17:25:42 -03:00
committed by John-David Dalton
parent 3ebb38d389
commit abb54cc49a
2 changed files with 6 additions and 22 deletions

View File

@@ -28,24 +28,12 @@ describe('toString', function() {
assert.deepStrictEqual(toString(values), '-0,-0,0,0');
});
it('should not error on symbols', function() {
if (Symbol) {
try {
assert.strictEqual(toString(symbol), 'Symbol(a)');
} catch (e) {
assert.ok(false, e.message);
}
}
it('should handle symbols', function() {
assert.strictEqual(toString(symbol), 'Symbol(a)');
});
it('should not error on an array of symbols', function() {
if (Symbol) {
try {
assert.strictEqual(toString([symbol]), 'Symbol(a)');
} catch (e) {
assert.ok(false, e.message);
}
}
it('should handle an array of symbols', function() {
assert.strictEqual(toString([symbol]), 'Symbol(a)');
});
it('should return the `toString` result of the wrapped value', function() {