mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-04 00:57:48 +00:00
Ensure _.toString does not throw on symbols.
This commit is contained in:
17
test/test.js
17
test/test.js
@@ -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);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user