mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-09 18:37:50 +00:00
Add map and set tests for clone methods.
This commit is contained in:
15
test/test.js
15
test/test.js
@@ -49,10 +49,12 @@
|
|||||||
fnToString = funcProto.toString,
|
fnToString = funcProto.toString,
|
||||||
freeze = Object.freeze,
|
freeze = Object.freeze,
|
||||||
JSON = root.JSON,
|
JSON = root.JSON,
|
||||||
|
Map = root.Map,
|
||||||
noop = function() {},
|
noop = function() {},
|
||||||
objToString = objectProto.toString,
|
objToString = objectProto.toString,
|
||||||
params = root.arguments,
|
params = root.arguments,
|
||||||
push = arrayProto.push,
|
push = arrayProto.push,
|
||||||
|
Set = root.Set,
|
||||||
slice = arrayProto.slice,
|
slice = arrayProto.slice,
|
||||||
Symbol = root.Symbol,
|
Symbol = root.Symbol,
|
||||||
system = root.system,
|
system = root.system,
|
||||||
@@ -1784,6 +1786,17 @@
|
|||||||
Foo.prototype = { 'b': 1 };
|
Foo.prototype = { 'b': 1 };
|
||||||
Foo.c = function() {};
|
Foo.c = function() {};
|
||||||
|
|
||||||
|
if (Map) {
|
||||||
|
var map = new Map;
|
||||||
|
map.set('a', 1);
|
||||||
|
map.set('b', 2);
|
||||||
|
}
|
||||||
|
if (Set) {
|
||||||
|
var set = new Set;
|
||||||
|
set.add(1);
|
||||||
|
set.add(2);
|
||||||
|
}
|
||||||
|
|
||||||
var objects = {
|
var objects = {
|
||||||
'`arguments` objects': arguments,
|
'`arguments` objects': arguments,
|
||||||
'arrays': ['a', ''],
|
'arrays': ['a', ''],
|
||||||
@@ -1794,10 +1807,12 @@
|
|||||||
'objects': { 'a': 0, 'b': 1, 'c': 3 },
|
'objects': { 'a': 0, 'b': 1, 'c': 3 },
|
||||||
'objects with object values': { 'a': /a/, 'b': ['B'], 'c': { 'C': 1 } },
|
'objects with object values': { 'a': /a/, 'b': ['B'], 'c': { 'C': 1 } },
|
||||||
'objects from another document': _._object || {},
|
'objects from another document': _._object || {},
|
||||||
|
'maps': map,
|
||||||
'null values': null,
|
'null values': null,
|
||||||
'numbers': 3,
|
'numbers': 3,
|
||||||
'number objects': Object(3),
|
'number objects': Object(3),
|
||||||
'regexes': /a/gim,
|
'regexes': /a/gim,
|
||||||
|
'sets': set,
|
||||||
'strings': 'a',
|
'strings': 'a',
|
||||||
'string objects': Object('a'),
|
'string objects': Object('a'),
|
||||||
'undefined values': undefined
|
'undefined values': undefined
|
||||||
|
|||||||
Reference in New Issue
Block a user