Ensure _.toString does not throw on symbols.

This commit is contained in:
John-David Dalton
2016-01-02 09:31:28 -06:00
parent f7c7dee8b0
commit 849f8e77ec
2 changed files with 20 additions and 2 deletions

View File

@@ -61,7 +61,7 @@
Set = root.Set,
slice = arrayProto.slice,
Symbol = root.Symbol,
symbol = Symbol ? Symbol() : undefined,
symbol = Symbol ? Symbol('a') : undefined,
Uint8Array = root.Uint8Array,
WeakMap = root.WeakMap;
@@ -20610,6 +20610,21 @@
assert.deepEqual(actual, expected);
});
QUnit.test('should not error on symbols', function(assert) {
assert.expect(1);
if (Symbol) {
try {
assert.strictEqual(_.toString(symbol), 'Symbol(a)');
} catch (e) {
assert.ok(false, e.message);
}
}
else {
skipTest(assert);
}
});
QUnit.test('should return the `toString` result of the wrapped value', function(assert) {
assert.expect(1);