Lines Matching refs:assert

8   QUnit.test('keys', function(assert) {  argument
9assert.deepEqual(_.keys({one: 1, two: 2}), ['one', 'two'], 'can extract the keys from an object');
12 assert.deepEqual(_.keys(a), ['1'], 'is not fooled by sparse arrays; see issue #95');
13 assert.deepEqual(_.keys(null), []);
14 assert.deepEqual(_.keys(void 0), []);
15 assert.deepEqual(_.keys(1), []);
16 assert.deepEqual(_.keys('a'), []);
17 assert.deepEqual(_.keys(true), []);
35 assert.deepEqual(_.keys(trouble).sort(), troubleKeys, 'matches non-enumerable properties');
38 QUnit.test('allKeys', function(assert) { argument
39assert.deepEqual(_.allKeys({one: 1, two: 2}), ['one', 'two'], 'can extract the allKeys from an obj…
42 assert.deepEqual(_.allKeys(a), ['1'], 'is not fooled by sparse arrays; see issue #95');
45assert.deepEqual(_.allKeys(a), ['1', 'a'], 'is not fooled by sparse arrays with additional propert…
48 assert.deepEqual(_.allKeys(val), []);
63 assert.deepEqual(_.allKeys(trouble).sort(), troubleKeys, 'matches non-enumerable properties');
69 assert.deepEqual(_.allKeys(b).sort(), ['bar', 'foo'], 'should include inherited keys');
73 assert.deepEqual(_.allKeys(y), ['x'], 'should get keys from constructor');
76 QUnit.test('values', function(assert) { argument
77 assert.deepEqual(_.values({one: 1, two: 2}), [1, 2], 'can extract the values from an object');
78assert.deepEqual(_.values({one: 1, two: 2, length: 3}), [1, 2, 3], '... even when one of them is "…
81 QUnit.test('pairs', function(assert) { argument
82assert.deepEqual(_.pairs({one: 1, two: 2}), [['one', 1], ['two', 2]], 'can convert an object into …
83assert.deepEqual(_.pairs({one: 1, two: 2, length: 3}), [['one', 1], ['two', 2], ['length', 3]], '.…
86 QUnit.test('invert', function(assert) { argument
88 assert.deepEqual(_.keys(_.invert(obj)), ['Moe', 'Larry', 'Curly'], 'can invert an object');
89 assert.deepEqual(_.invert(_.invert(obj)), obj, 'two inverts gets you back where you started');
92 assert.equal(_.invert(obj)['3'], 'length', 'can invert an object with "length"');
95 QUnit.test('functions', function(assert) { argument
97assert.deepEqual(['b', 'd'], _.functions(obj), 'can grab the function names of any passed-in objec…
101 assert.deepEqual(_.functions(new Animal), ['run'], 'also looks up functions on the prototype');
104 QUnit.test('methods', function(assert) { argument
105 assert.strictEqual(_.methods, _.functions, 'is an alias for functions');
108 QUnit.test('extend', function(assert) { argument
110assert.equal(_.extend({}, {a: 'b'}).a, 'b', 'can extend an object with the attributes of another');
111 assert.equal(_.extend({a: 'x'}, {a: 'b'}).a, 'b', 'properties in source override destination');
112assert.equal(_.extend({x: 'x'}, {a: 'b'}).x, 'x', "properties not in source don't get overriden");
114 assert.deepEqual(result, {x: 'x', a: 'a', b: 'b'}, 'can extend from multiple source objects');
116assert.deepEqual(result, {x: 2, a: 'b'}, 'extending from multiple source objects last property tru…
118 assert.deepEqual(_.keys(result), ['a', 'b'], 'extend copies undefined values');
124assert.deepEqual(_.extend({}, subObj), {a: 'b', c: 'd'}, 'extend copies all properties from source…
126assert.notOk(subObj.hasOwnProperty('a'), "extend does not convert destination object's 'in' proper…
133 assert.equal(result.a, 1, 'should not error on `null` or `undefined` sources');
135 assert.strictEqual(_.extend(null, {a: 1}), null, 'extending null results in null');
136assert.strictEqual(_.extend(void 0, {a: 1}), void 0, 'extending undefined results in undefined');
139 QUnit.test('extendOwn', function(assert) { argument
141assert.equal(_.extendOwn({}, {a: 'b'}).a, 'b', 'can extend an object with the attributes of anothe…
142assert.equal(_.extendOwn({a: 'x'}, {a: 'b'}).a, 'b', 'properties in source override destination');
143assert.equal(_.extendOwn({x: 'x'}, {a: 'b'}).x, 'x', "properties not in source don't get overriden…
145 assert.deepEqual(result, {x: 'x', a: 'a', b: 'b'}, 'can extend from multiple source objects');
147assert.deepEqual(result, {x: 2, a: 'b'}, 'extending from multiple source objects last property tru…
148assert.deepEqual(_.extendOwn({}, {a: void 0, b: null}), {a: void 0, b: null}, 'copies undefined va…
154 assert.deepEqual(_.extendOwn({}, subObj), {c: 'd'}, 'copies own properties from source');
157assert.deepEqual(_.extendOwn(result, null, void 0, {a: 1}), {a: 1}, 'should not error on `null` or…
160assert.strictEqual(_.extendOwn(val, {a: 1}), val, 'extending non-objects results in returning the …
163assert.strictEqual(_.extendOwn(void 0, {a: 1}), void 0, 'extending undefined results in undefined'…
166assert.deepEqual(result, {a: 1, 0: 1, 1: 2, length: 2}, 'should treat array-like objects like norm…
169 QUnit.test('assign', function(assert) { argument
170 assert.strictEqual(_.assign, _.extendOwn, 'is an alias for extendOwn');
173 QUnit.test('pick', function(assert) { argument
176 assert.deepEqual(result, {a: 1, c: 3}, 'can restrict properties to those named');
178 assert.deepEqual(result, {b: 2, c: 3}, 'can restrict properties to those named in an array');
180 assert.deepEqual(result, {a: 1, b: 2}, 'can restrict properties to those named in mixed args');
182 assert.deepEqual(result, {1: 'b'}, 'can pick numeric properties');
185 assert.deepEqual(_.pick(val, 'hasOwnProperty'), {}, 'Called with null/undefined');
186 assert.deepEqual(_.pick(val, _.constant(true)), {});
188assert.deepEqual(_.pick(5, 'toString', 'b'), {toString: Number.prototype.toString}, 'can iterate p…
192 assert.strictEqual(key, {1: 'a', 2: 'b', 3: 'c'}[value]);
193 assert.strictEqual(object, data);
197 assert.deepEqual(result, {a: 1, c: 3}, 'can accept a predicate and context');
202 assert.deepEqual(_.pick(instance, 'a', 'c'), {a: 1, c: 3}, 'include prototype props');
204 assert.deepEqual(_.pick(data, function(val, key) {
208assert.notOk(_.has(_.pick({}, 'foo'), 'foo'), 'does not set own property if property not in object…
210 assert.equal(obj, data, 'passes same object as third parameter of iteratee');
214 QUnit.test('omit', function(assert) { argument
217 assert.deepEqual(result, {a: 1, c: 3}, 'can omit a single named property');
219 assert.deepEqual(result, {b: 2}, 'can omit several named properties');
221 assert.deepEqual(result, {a: 1}, 'can omit properties named in an array');
223 assert.deepEqual(result, {1: 'b'}, 'can omit numeric properties');
225 assert.deepEqual(_.omit(null, 'a', 'b'), {}, 'non objects return empty object');
226 assert.deepEqual(_.omit(void 0, 'toString'), {}, 'null/undefined return empty object');
227 assert.deepEqual(_.omit(5, 'toString', 'b'), {}, 'returns empty object for primitives');
231 assert.strictEqual(key, {1: 'a', 2: 'b', 3: 'c'}[value]);
232 assert.strictEqual(object, data);
236 assert.deepEqual(result, {b: 2}, 'can accept a predicate');
241 assert.deepEqual(_.omit(instance, 'b'), {a: 1, c: 3}, 'include prototype props');
243 assert.deepEqual(_.omit(data, function(val, key) {
248 QUnit.test('defaults', function(assert) { argument
252 assert.equal(options.zero, 0, 'value exists');
253 assert.equal(options.one, 1, 'value exists');
254 assert.equal(options.twenty, 20, 'default applied');
255 assert.equal(options.nothing, null, "null isn't overridden");
258 assert.equal(options.empty, '', 'value exists');
259 assert.ok(_.isNaN(options.nan), "NaN isn't overridden");
260 assert.equal(options.word, 'word', 'new value is added, first one wins');
267 assert.equal(options.a, 1, 'should not error on `null` or `undefined` sources');
269 assert.deepEqual(_.defaults(null, {a: 1}), {a: 1}, 'defaults skips nulls');
270 assert.deepEqual(_.defaults(void 0, {a: 1}), {a: 1}, 'defaults skips undefined');
273 QUnit.test('clone', function(assert) { argument
276 assert.equal(clone.name, 'moe', 'the clone as the attributes of the original');
279assert.ok(clone.name === 'curly' && moe.name === 'moe', 'clones can change shallow attributes with…
282 assert.equal(_.last(moe.lucky), 101, 'changes to deep attributes are shared with the original');
284 assert.equal(_.clone(void 0), void 0, 'non objects should not be changed by clone');
285 assert.equal(_.clone(1), 1, 'non objects should not be changed by clone');
286 assert.equal(_.clone(null), null, 'non objects should not be changed by clone');
289 QUnit.test('create', function(assert) { argument
294assert.deepEqual(_.create(val), {}, 'should return empty object when a non-object is provided');
297assert.ok(_.create([]) instanceof Array, 'should return new instance of array when array is provid…
301 assert.ok(new Child instanceof Parent, 'object should inherit prototype');
305 assert.strictEqual(Child.prototype.func, func, 'properties should be added to object');
308 assert.strictEqual(Child.prototype.constructor, Child);
312 assert.notOk(created.hasOwnProperty('foo'), 'should only add own properties');
315 QUnit.test('isEqual', function(assert) { argument
326 assert.ok(_.isEqual(null, null), '`null` is equal to `null`');
327 assert.ok(_.isEqual(), '`undefined` is equal to `undefined`');
329 assert.notOk(_.isEqual(0, -0), '`0` is not equal to `-0`');
330 assert.notOk(_.isEqual(-0, 0), 'Commutative equality is implemented for `0` and `-0`');
331 assert.notOk(_.isEqual(null, void 0), '`null` is not equal to `undefined`');
332assert.notOk(_.isEqual(void 0, null), 'Commutative equality is implemented for `null` and `undefin…
335 assert.ok(_.isEqual('Curly', 'Curly'), 'Identical string primitives are equal');
336assert.ok(_.isEqual(new String('Curly'), new String('Curly')), 'String objects with identical prim…
337assert.ok(_.isEqual(new String('Curly'), 'Curly'), 'String primitives and their corresponding obje…
338assert.ok(_.isEqual('Curly', new String('Curly')), 'Commutative equality is implemented for string…
340assert.notOk(_.isEqual('Curly', 'Larry'), 'String primitives with different values are not equal');
341assert.notOk(_.isEqual(new String('Curly'), new String('Larry')), 'String objects with different p…
342assert.notOk(_.isEqual(new String('Curly'), {toString: function(){ return 'Curly'; }}), 'String ob…
345 assert.ok(_.isEqual(75, 75), 'Identical number primitives are equal');
346assert.ok(_.isEqual(new Number(75), new Number(75)), 'Number objects with identical primitive valu…
347assert.ok(_.isEqual(75, new Number(75)), 'Number primitives and their corresponding object wrapper…
348assert.ok(_.isEqual(new Number(75), 75), 'Commutative equality is implemented for number objects a…
349 assert.notOk(_.isEqual(new Number(0), -0), '`new Number(0)` and `-0` are not equal');
350assert.notOk(_.isEqual(0, new Number(-0)), 'Commutative equality is implemented for `new Number(0)…
352assert.notOk(_.isEqual(new Number(75), new Number(63)), 'Number objects with different primitive v…
353assert.notOk(_.isEqual(new Number(63), {valueOf: function(){ return 63; }}), 'Number objects and o…
356 assert.ok(_.isEqual(NaN, NaN), '`NaN` is equal to `NaN`');
357 assert.ok(_.isEqual(new Number(NaN), NaN), 'Object(`NaN`) is equal to `NaN`');
358 assert.notOk(_.isEqual(61, NaN), 'A number primitive is not equal to `NaN`');
359 assert.notOk(_.isEqual(new Number(79), NaN), 'A number object is not equal to `NaN`');
360 assert.notOk(_.isEqual(Infinity, NaN), '`Infinity` is not equal to `NaN`');
363 assert.ok(_.isEqual(true, true), 'Identical boolean primitives are equal');
364assert.ok(_.isEqual(new Boolean, new Boolean), 'Boolean objects with identical primitive values ar…
365assert.ok(_.isEqual(true, new Boolean(true)), 'Boolean primitives and their corresponding object w…
366assert.ok(_.isEqual(new Boolean(true), true), 'Commutative equality is implemented for booleans');
367assert.notOk(_.isEqual(new Boolean(true), new Boolean), 'Boolean objects with different primitive …
370assert.notOk(_.isEqual(new Boolean(false), true), '`new Boolean(false)` is not equal to `true`');
371assert.notOk(_.isEqual('75', 75), 'String and number primitives with like values are not equal');
372assert.notOk(_.isEqual(new Number(63), new String(63)), 'String and number objects with like value…
373assert.notOk(_.isEqual(75, '75'), 'Commutative equality is implemented for like string and number …
374 assert.notOk(_.isEqual(0, ''), 'Number and string primitives with like values are not equal');
375assert.notOk(_.isEqual(1, true), 'Number and boolean primitives with like values are not equal');
376assert.notOk(_.isEqual(new Boolean(false), new Number(0)), 'Boolean and number objects with like v…
377assert.notOk(_.isEqual(false, new String('')), 'Boolean primitives and string objects with like va…
378assert.notOk(_.isEqual(12564504e5, new Date(2009, 9, 25)), 'Dates and their corresponding numeric …
381assert.ok(_.isEqual(new Date(2009, 9, 25), new Date(2009, 9, 25)), 'Date objects referencing ident…
382assert.notOk(_.isEqual(new Date(2009, 9, 25), new Date(2009, 11, 13)), 'Date objects referencing d…
383 assert.notOk(_.isEqual(new Date(2009, 11, 13), {
388 assert.notOk(_.isEqual(new Date('Curly'), new Date('Curly')), 'Invalid dates are not equal');
391assert.notOk(_.isEqual(First, Second), 'Different functions with identical bodies and source code …
394assert.ok(_.isEqual(/(?:)/gim, /(?:)/gim), 'RegExps with equivalent patterns and flags are equal');
395 assert.ok(_.isEqual(/(?:)/gi, /(?:)/ig), 'Flag order is not significant');
396assert.notOk(_.isEqual(/(?:)/g, /(?:)/gi), 'RegExps with equivalent patterns and different flags a…
397assert.notOk(_.isEqual(/Moe/gim, /Curly/gim), 'RegExps with different patterns and equivalent flag…
398 assert.notOk(_.isEqual(/(?:)/gi, /(?:)/g), 'Commutative equality is implemented for RegExps');
399assert.notOk(_.isEqual(/Curly/g, {source: 'Larry', global: true, ignoreCase: false, multiline: fal…
402 assert.ok(_.isEqual({}, {}), 'Empty object literals are equal');
403 assert.ok(_.isEqual([], []), 'Empty array literals are equal');
404 assert.ok(_.isEqual([{}], [{}]), 'Empty nested arrays and objects are equal');
405 assert.notOk(_.isEqual({length: 0}, []), 'Array-like objects and arrays are not equal.');
406assert.notOk(_.isEqual([], {length: 0}), 'Commutative equality is implemented for array-like objec…
408 assert.notOk(_.isEqual({}, []), 'Object literals and array literals are not equal');
409 assert.notOk(_.isEqual([], {}), 'Commutative equality is implemented for objects and arrays');
412assert.ok(_.isEqual([1, 'Larry', true], [1, 'Larry', true]), 'Arrays containing identical primitiv…
413assert.ok(_.isEqual([/Moe/g, new Date(2009, 9, 25)], [/Moe/g, new Date(2009, 9, 25)]), 'Arrays con…
418assert.ok(_.isEqual(a, b), 'Arrays containing nested arrays and objects are recursively compared');
425assert.ok(_.isEqual(a, b), 'Arrays containing equivalent elements and different non-numeric proper…
427 assert.notOk(_.isEqual(a, b), 'Arrays of different lengths are not equal');
430assert.notOk(_.isEqual(a, b), 'Arrays of identical lengths containing different elements are not e…
433 assert.ok(_.isEqual(Array(3), Array(3)), 'Sparse arrays of identical lengths are equal');
434assert.notOk(_.isEqual(Array(3), Array(6)), 'Sparse arrays of different lengths are not equal when…
438 assert.ok(_.isEqual(sparse, [void 0, 5]), 'Handles sparse arrays as dense');
441assert.ok(_.isEqual({a: 'Curly', b: 1, c: true}, {a: 'Curly', b: 1, c: true}), 'Objects containing…
442assert.ok(_.isEqual({a: /Curly/g, b: new Date(2009, 11, 13)}, {a: /Curly/g, b: new Date(2009, 11, …
443assert.notOk(_.isEqual({a: 63, b: 75}, {a: 61, b: 55}), 'Objects of identical sizes with different…
444assert.notOk(_.isEqual({a: 63, b: 75}, {a: 61, c: 55}), 'Objects of identical sizes with different…
445 assert.notOk(_.isEqual({a: 1, b: 2}, {a: 1}), 'Objects of different sizes are not equal');
446assert.notOk(_.isEqual({a: 1}, {a: 1, b: 2}), 'Commutative equality is implemented for objects');
447assert.notOk(_.isEqual({x: 1, y: void 0}, {x: 1, z: 2}), 'Objects with identical keys and differen…
478 assert.ok(_.isEqual(a, b), 'Objects with nested equivalent members are recursively compared');
481 assert.ok(_.isEqual(new First, new First), 'Object instances are equal');
482assert.notOk(_.isEqual(new First, new Second), 'Objects with different constructors and identical …
483assert.notOk(_.isEqual({value: 1}, new First), 'Object instances and objects sharing equivalent pr…
484assert.notOk(_.isEqual({value: 2}, new Second), 'The prototype chain of objects should not be exam…
489 assert.ok(_.isEqual(a, b), 'Arrays containing circular references are equal');
492assert.ok(_.isEqual(a, b), 'Arrays containing circular references and equivalent properties are eq…
495assert.notOk(_.isEqual(a, b), 'Arrays containing circular references and different properties are …
501assert.notOk(_.isEqual(a, b), 'Comparison of circular references with non-circular references are …
508 assert.ok(_.isEqual(a, b), 'Objects containing circular references are equal');
511assert.ok(_.isEqual(a, b), 'Objects containing circular references and equivalent properties are e…
514assert.notOk(_.isEqual(a, b), 'Objects containing circular references and different properties are…
520assert.notOk(_.isEqual(a, b), 'Comparison of circular references with non-circular object referenc…
527 assert.ok(_.isEqual(a, b), 'Cyclic structures are equal');
530 assert.ok(_.isEqual(a, b), 'Cyclic structures containing equivalent properties are equal');
533assert.notOk(_.isEqual(a, b), 'Cyclic structures containing different properties are not equal');
540assert.ok(_.isEqual(a, b), 'Cyclic structures with nested and identically-named properties are equ…
543assert.notOk(_.isEqual(_({x: 1, y: void 0}).chain(), _({x: 1, z: 2}).chain()), 'Chained objects co…
547 assert.equal(_.isEqual(a.isEqual(b), _(true)), true, '`isEqual` can be chained');
553 assert.ok(_.isEqual(a, b), 'Handles objects without a constructor (e.g. from Object.create');
560assert.strictEqual(_.isEqual(new Foo, other), false, 'Objects from different constructors are not …
564 assert.equal(_.isEqual([0], [-0]), false);
565 assert.equal(_.isEqual({a: 0}, {a: -0}), false);
566 assert.equal(_.isEqual([NaN], [NaN]), true);
567 assert.equal(_.isEqual({a: NaN}, {a: NaN}), true);
571 assert.strictEqual(_.isEqual(symbol, symbol), true, 'A symbol is equal to itself');
572 assert.strictEqual(_.isEqual(symbol, Object(symbol)), true, 'Even when wrapped in Object()');
573 assert.strictEqual(_.isEqual(symbol, null), false, 'Different types are not equal');
578 QUnit.test('isEmpty', function(assert) { argument
579 assert.notOk(_([1]).isEmpty(), '[1] is not empty');
580 assert.ok(_.isEmpty([]), '[] is empty');
581 assert.notOk(_.isEmpty({one: 1}), '{one: 1} is not empty');
582 assert.ok(_.isEmpty({}), '{} is empty');
583 assert.ok(_.isEmpty(new RegExp('')), 'objects with prototype properties are empty');
584 assert.ok(_.isEmpty(null), 'null is empty');
585 assert.ok(_.isEmpty(), 'undefined is empty');
586 assert.ok(_.isEmpty(''), 'the empty string is empty');
587 assert.notOk(_.isEmpty('moe'), 'but other strings are not');
591 assert.ok(_.isEmpty(obj), 'deleting all the keys from an object empties it');
594 assert.ok(_.isEmpty(args()), 'empty arguments object is empty');
595 assert.notOk(_.isEmpty(args('')), 'non-empty arguments object is not empty');
599 assert.notOk(_.isEmpty(nonEnumProp), 'non-enumerable property is not empty');
603 QUnit.test('isElement', function(assert) { argument
604 assert.notOk(_.isElement('div'), 'strings are not dom elements');
605 assert.ok(_.isElement(testElement), 'an element is a DOM element');
609 QUnit.test('isArguments', function(assert) { argument
611 assert.notOk(_.isArguments('string'), 'a string is not an arguments object');
612 assert.notOk(_.isArguments(_.isArguments), 'a function is not an arguments object');
613 assert.ok(_.isArguments(args), 'but the arguments object is an arguments object');
614 assert.notOk(_.isArguments(_.toArray(args)), 'but not when it\'s converted into an array');
615 assert.notOk(_.isArguments([1, 2, 3]), 'and not vanilla arrays.');
618 QUnit.test('isObject', function(assert) { argument
619 assert.ok(_.isObject(arguments), 'the arguments object is object');
620 assert.ok(_.isObject([1, 2, 3]), 'and arrays');
622 assert.ok(_.isObject(testElement), 'and DOM element');
624 assert.ok(_.isObject(function() {}), 'and functions');
625 assert.notOk(_.isObject(null), 'but not null');
626 assert.notOk(_.isObject(void 0), 'and not undefined');
627 assert.notOk(_.isObject('string'), 'and not string');
628 assert.notOk(_.isObject(12), 'and not number');
629 assert.notOk(_.isObject(true), 'and not boolean');
630 assert.ok(_.isObject(new String('string')), 'but new String()');
633 QUnit.test('isArray', function(assert) { argument
634 assert.notOk(_.isArray(void 0), 'undefined vars are not arrays');
635 assert.notOk(_.isArray(arguments), 'the arguments object is not an array');
636 assert.ok(_.isArray([1, 2, 3]), 'but arrays are');
639 QUnit.test('isString', function(assert) { argument
642 assert.notOk(_.isString(testElement), 'an element is not a string');
644 assert.ok(_.isString([1, 2, 3].join(', ')), 'but strings are');
645 assert.strictEqual(_.isString('I am a string literal'), true, 'string literals are');
646 assert.ok(_.isString(obj), 'so are String objects');
647 assert.strictEqual(_.isString(1), false);
650 QUnit.test('isSymbol', function(assert) { argument
651 assert.notOk(_.isSymbol(0), 'numbers are not symbols');
652 assert.notOk(_.isSymbol(''), 'strings are not symbols');
653 assert.notOk(_.isSymbol(_.isSymbol), 'functions are not symbols');
655 assert.ok(_.isSymbol(Symbol()), 'symbols are symbols');
656 assert.ok(_.isSymbol(Symbol('description')), 'described symbols are symbols');
657 assert.ok(_.isSymbol(Object(Symbol())), 'boxed symbols are symbols');
661 QUnit.test('isNumber', function(assert) { argument
662 assert.notOk(_.isNumber('string'), 'a string is not a number');
663 assert.notOk(_.isNumber(arguments), 'the arguments object is not a number');
664 assert.notOk(_.isNumber(void 0), 'undefined is not a number');
665 assert.ok(_.isNumber(3 * 4 - 7 / 10), 'but numbers are');
666 assert.ok(_.isNumber(NaN), 'NaN *is* a number');
667 assert.ok(_.isNumber(Infinity), 'Infinity is a number');
668 assert.notOk(_.isNumber('1'), 'numeric strings are not numbers');
671 QUnit.test('isBoolean', function(assert) { argument
672 assert.notOk(_.isBoolean(2), 'a number is not a boolean');
673 assert.notOk(_.isBoolean('string'), 'a string is not a boolean');
674 assert.notOk(_.isBoolean('false'), 'the string "false" is not a boolean');
675 assert.notOk(_.isBoolean('true'), 'the string "true" is not a boolean');
676 assert.notOk(_.isBoolean(arguments), 'the arguments object is not a boolean');
677 assert.notOk(_.isBoolean(void 0), 'undefined is not a boolean');
678 assert.notOk(_.isBoolean(NaN), 'NaN is not a boolean');
679 assert.notOk(_.isBoolean(null), 'null is not a boolean');
680 assert.ok(_.isBoolean(true), 'but true is');
681 assert.ok(_.isBoolean(false), 'and so is false');
684 QUnit.test('isMap', function(assert) { argument
685 assert.notOk(_.isMap('string'), 'a string is not a map');
686 assert.notOk(_.isMap(2), 'a number is not a map');
687 assert.notOk(_.isMap({}), 'an object is not a map');
688 assert.notOk(_.isMap(false), 'a boolean is not a map');
689 assert.notOk(_.isMap(void 0), 'undefined is not a map');
690 assert.notOk(_.isMap([1, 2, 3]), 'an array is not a map');
692 assert.notOk(_.isMap(new Set()), 'a set is not a map');
695 assert.notOk(_.isMap(new WeakSet()), 'a weakset is not a map');
698 assert.notOk(_.isMap(new WeakMap()), 'a weakmap is not a map');
704 assert.ok(_.isMap(obj), 'but a map is');
708 QUnit.test('isWeakMap', function(assert) { argument
709 assert.notOk(_.isWeakMap('string'), 'a string is not a weakmap');
710 assert.notOk(_.isWeakMap(2), 'a number is not a weakmap');
711 assert.notOk(_.isWeakMap({}), 'an object is not a weakmap');
712 assert.notOk(_.isWeakMap(false), 'a boolean is not a weakmap');
713 assert.notOk(_.isWeakMap(void 0), 'undefined is not a weakmap');
714 assert.notOk(_.isWeakMap([1, 2, 3]), 'an array is not a weakmap');
716 assert.notOk(_.isWeakMap(new Set()), 'a set is not a weakmap');
719 assert.notOk(_.isWeakMap(new WeakSet()), 'a weakset is not a weakmap');
722 assert.notOk(_.isWeakMap(new Map()), 'a map is not a weakmap');
727 assert.ok(_.isWeakMap(obj), 'but a weakmap is');
731 QUnit.test('isSet', function(assert) { argument
732 assert.notOk(_.isSet('string'), 'a string is not a set');
733 assert.notOk(_.isSet(2), 'a number is not a set');
734 assert.notOk(_.isSet({}), 'an object is not a set');
735 assert.notOk(_.isSet(false), 'a boolean is not a set');
736 assert.notOk(_.isSet(void 0), 'undefined is not a set');
737 assert.notOk(_.isSet([1, 2, 3]), 'an array is not a set');
739 assert.notOk(_.isSet(new Map()), 'a map is not a set');
742 assert.notOk(_.isSet(new WeakMap()), 'a weakmap is not a set');
745 assert.notOk(_.isSet(new WeakSet()), 'a weakset is not a set');
750 assert.ok(_.isSet(obj), 'but a set is');
754 QUnit.test('isWeakSet', function(assert) { argument
756 assert.notOk(_.isWeakSet('string'), 'a string is not a weakset');
757 assert.notOk(_.isWeakSet(2), 'a number is not a weakset');
758 assert.notOk(_.isWeakSet({}), 'an object is not a weakset');
759 assert.notOk(_.isWeakSet(false), 'a boolean is not a weakset');
760 assert.notOk(_.isWeakSet(void 0), 'undefined is not a weakset');
761 assert.notOk(_.isWeakSet([1, 2, 3]), 'an array is not a weakset');
763 assert.notOk(_.isWeakSet(new Map()), 'a map is not a weakset');
766 assert.notOk(_.isWeakSet(new WeakMap()), 'a weakmap is not a weakset');
769 assert.notOk(_.isWeakSet(new Set()), 'a set is not a weakset');
774 assert.ok(_.isWeakSet(obj), 'but a weakset is');
778 QUnit.test('isFunction', function(assert) { argument
779 assert.notOk(_.isFunction(void 0), 'undefined vars are not functions');
780 assert.notOk(_.isFunction([1, 2, 3]), 'arrays are not functions');
781 assert.notOk(_.isFunction('moe'), 'strings are not functions');
782 assert.ok(_.isFunction(_.isFunction), 'but functions are');
783 assert.ok(_.isFunction(function(){}), 'even anonymous ones');
786 assert.notOk(_.isFunction(testElement), 'elements are not functions');
791 assert.notOk(_.isFunction(nodelist));
796 QUnit.test('#1929 Typed Array constructors are functions', function(assert) { argument
803assert.strictEqual(_.isFunction(TypedArray), Object.prototype.toString.call(TypedArray) === '[obje…
808 QUnit.test('isDate', function(assert) { argument
809 assert.notOk(_.isDate(100), 'numbers are not dates');
810 assert.notOk(_.isDate({}), 'objects are not dates');
811 assert.ok(_.isDate(new Date()), 'but dates are');
814 QUnit.test('isRegExp', function(assert) { argument
815 assert.notOk(_.isRegExp(_.identity), 'functions are not RegExps');
816 assert.ok(_.isRegExp(/identity/), 'but RegExps are');
819 QUnit.test('isFinite', function(assert) { argument
820 assert.notOk(_.isFinite(void 0), 'undefined is not finite');
821 assert.notOk(_.isFinite(null), 'null is not finite');
822 assert.notOk(_.isFinite(NaN), 'NaN is not finite');
823 assert.notOk(_.isFinite(Infinity), 'Infinity is not finite');
824 assert.notOk(_.isFinite(-Infinity), '-Infinity is not finite');
825 assert.ok(_.isFinite('12'), 'Numeric strings are numbers');
826 assert.notOk(_.isFinite('1a'), 'Non numeric strings are not numbers');
827 assert.notOk(_.isFinite(''), 'Empty strings are not numbers');
829 assert.ok(_.isFinite(obj), 'Number instances can be finite');
830 assert.ok(_.isFinite(0), '0 is finite');
831 assert.ok(_.isFinite(123), 'Ints are finite');
832 assert.ok(_.isFinite(-12.44), 'Floats are finite');
834 assert.notOk(_.isFinite(Symbol()), 'symbols are not numbers');
835 assert.notOk(_.isFinite(Symbol('description')), 'described symbols are not numbers');
836 assert.notOk(_.isFinite(Object(Symbol())), 'boxed symbols are not numbers');
840 QUnit.test('isNaN', function(assert) { argument
841 assert.notOk(_.isNaN(void 0), 'undefined is not NaN');
842 assert.notOk(_.isNaN(null), 'null is not NaN');
843 assert.notOk(_.isNaN(0), '0 is not NaN');
844 assert.notOk(_.isNaN(new Number(0)), 'wrapped 0 is not NaN');
845 assert.ok(_.isNaN(NaN), 'but NaN is');
846 assert.ok(_.isNaN(new Number(NaN)), 'wrapped NaN is still NaN');
848 assert.notOk(_.isNaN(Symbol()), 'symbol is not NaN');
852 QUnit.test('isNull', function(assert) { argument
853 assert.notOk(_.isNull(void 0), 'undefined is not null');
854 assert.notOk(_.isNull(NaN), 'NaN is not null');
855 assert.ok(_.isNull(null), 'but null is');
858 QUnit.test('isUndefined', function(assert) { argument
859 assert.notOk(_.isUndefined(1), 'numbers are defined');
860 assert.notOk(_.isUndefined(null), 'null is defined');
861 assert.notOk(_.isUndefined(false), 'false is defined');
862 assert.notOk(_.isUndefined(NaN), 'NaN is defined');
863 assert.ok(_.isUndefined(), 'nothing is undefined');
864 assert.ok(_.isUndefined(void 0), 'undefined is undefined');
867 QUnit.test('isError', function(assert) { argument
868 assert.notOk(_.isError(1), 'numbers are not Errors');
869 assert.notOk(_.isError(null), 'null is not an Error');
870 assert.notOk(_.isError(Error), 'functions are not Errors');
871 assert.ok(_.isError(new Error()), 'Errors are Errors');
872 assert.ok(_.isError(new EvalError()), 'EvalErrors are Errors');
873 assert.ok(_.isError(new RangeError()), 'RangeErrors are Errors');
874 assert.ok(_.isError(new ReferenceError()), 'ReferenceErrors are Errors');
875 assert.ok(_.isError(new SyntaxError()), 'SyntaxErrors are Errors');
876 assert.ok(_.isError(new TypeError()), 'TypeErrors are Errors');
877 assert.ok(_.isError(new URIError()), 'URIErrors are Errors');
880 QUnit.test('tap', function(assert) { argument
884 assert.equal(intercepted, 1, 'passes tapped object to interceptor');
885 assert.equal(returned, 1, 'returns tapped object');
892 assert.equal(returned, 6, 'can use tapped objects in a chain');
893 assert.equal(intercepted, returned, 'can use tapped objects in a chain');
896 QUnit.test('has', function(assert) { argument
898 assert.ok(_.has(obj, 'foo'), 'has() checks that the object has a property.');
899 assert.notOk(_.has(obj, 'baz'), "has() returns false if the object doesn't have the property.");
900 assert.ok(_.has(obj, 'func'), 'has() works for functions too.');
902 assert.ok(_.has(obj, 'foo'), 'has() works even when the hasOwnProperty method is deleted.');
905 assert.notOk(_.has(child, 'foo'), 'has() does not check the prototype chain for a property.');
906 assert.strictEqual(_.has(null, 'foo'), false, 'has() returns false for null');
907 assert.strictEqual(_.has(void 0, 'foo'), false, 'has() returns false for undefined');
910 QUnit.test('isMatch', function(assert) { argument
914 assert.equal(_.isMatch(moe, {hair: true}), true, 'Returns a boolean');
915 assert.equal(_.isMatch(curly, {hair: true}), false, 'Returns a boolean');
917 assert.equal(_.isMatch(5, {__x__: void 0}), false, 'can match undefined props on primitives');
918 assert.equal(_.isMatch({__x__: void 0}, {__x__: void 0}), true, 'can match undefined props');
920 assert.equal(_.isMatch(null, {}), true, 'Empty spec called with null object returns true');
921assert.equal(_.isMatch(null, {a: 1}), false, 'Non-empty spec called with null object returns false…
923 …_.each([null, void 0], function(item) { assert.strictEqual(_.isMatch(item, null), true, 'null matc…
924 …_.each([null, void 0], function(item) { assert.strictEqual(_.isMatch(item, null), true, 'null matc…
925 assert.strictEqual(_.isMatch({b: 1}, {a: void 0}), false, 'handles undefined values (1683)');
928 assert.strictEqual(_.isMatch({a: 1}, item), true, 'treats primitives as empty');
934 assert.equal(_.isMatch({x: 2}, specObj), true, 'spec is restricted to own properties');
937 assert.equal(_.isMatch({x: 1, y: 5}, specObj), true);
938 assert.equal(_.isMatch({x: 1, y: 4}, specObj), false);
940assert.ok(_.isMatch(specObj, {x: 1, y: 5}), 'inherited and own properties are checked on the test …
943 assert.ok(_.isMatch({x: 5, y: 1}, Prototest), 'spec can be a function');
947assert.deepEqual(_.map([null, void 0, 5, {}], _.partial(_.isMatch, _, oCon)), [false, false, false…
950 QUnit.test('matcher', function(assert) { argument
955 assert.equal(_.matcher({hair: true})(moe), true, 'Returns a boolean');
956 assert.equal(_.matcher({hair: true})(curly), false, 'Returns a boolean');
958 assert.equal(_.matcher({__x__: void 0})(5), false, 'can match undefined props on primitives');
959 assert.equal(_.matcher({__x__: void 0})({__x__: void 0}), true, 'can match undefined props');
961 assert.equal(_.matcher({})(null), true, 'Empty spec called with null object returns true');
962assert.equal(_.matcher({a: 1})(null), false, 'Non-empty spec called with null object returns false…
964assert.strictEqual(_.find(stooges, _.matcher({hair: false})), curly, 'returns a predicate that can…
965assert.strictEqual(_.find(stooges, _.matcher(moe)), moe, 'can be used to locate an object exists i…
966assert.deepEqual(_.filter([null, void 0], _.matcher({a: 1})), [], 'Do not throw on null values.');
968assert.deepEqual(_.filter([null, void 0], _.matcher(null)), [null, void 0], 'null matches null');
969 assert.deepEqual(_.filter([null, void 0], _.matcher({})), [null, void 0], 'null matches {}');
970assert.deepEqual(_.filter([{b: 1}], _.matcher({a: void 0})), [], 'handles undefined values (1683)'…
973 assert.equal(_.matcher(item)({a: 1}), true, 'treats primitives as empty');
980 assert.equal(protospec({x: 2}), true, 'spec is restricted to own properties');
984 assert.equal(protospec({x: 1, y: 5}), true);
985 assert.equal(protospec({x: 1, y: 4}), false);
987assert.ok(_.matcher({x: 1, y: 5})(specObj), 'inherited and own properties are checked on the test …
990 assert.ok(_.matcher(Prototest)({x: 5, y: 1}), 'spec can be a function');
996 assert.equal(m({b: 1}), true);
999 assert.equal(m({b: 1}), true, 'changing spec object doesnt change matches result');
1004assert.deepEqual(_.map([null, void 0, 5, {}], oCon), [false, false, false, true], 'doesnt falsey m…
1007 QUnit.test('matches', function(assert) { argument
1008 assert.strictEqual(_.matches, _.matcher, 'is an alias for matcher');
1011 QUnit.test('findKey', function(assert) { argument
1018 assert.equal(_.findKey(objects, function(obj) {
1022 assert.equal(_.findKey(objects, function(obj) {
1026 assert.equal(_.findKey(objects, 'a'), 'b', 'Uses lookupIterator');
1028 assert.equal(_.findKey(objects, function(obj) {
1032 assert.strictEqual(_.findKey([1, 2, 3, 4, 5, 6], function(obj) {
1036 assert.strictEqual(_.findKey(objects, function(a) {
1041 assert.equal(key, 'a');
1042 assert.deepEqual(obj, {a: {a: 1}});
1043 assert.strictEqual(this, objects, 'called with context');
1048assert.strictEqual(_.findKey(array, function(x) { return x === 55; }), 'match', 'matches array-lik…
1052 QUnit.test('mapObject', function(assert) { argument
1060 assert.deepEqual(_.mapObject(obj, function(val) {
1064 assert.deepEqual(_.mapObject(objects, function(val) {
1070 assert.deepEqual(_.mapObject(obj, function(val, key, o) {
1074 assert.deepEqual(_.mapObject([1, 2], function(val) {
1078 assert.deepEqual(_.mapObject(obj, function(val) {
1082 assert.deepEqual(_.mapObject({a: 1}, function() {
1089 assert.deepEqual(ids, {length: void 0, 0: '1', 1: '2'}, 'Check with array-like objects');
1093assert.deepEqual(_.mapObject(people, 'name'), {a: 'moe', b: 'curly'}, 'predicate string map to obj…
1096 assert.deepEqual(_.mapObject(val, _.identity), {}, 'mapValue identity');
1102assert.deepEqual(_.mapObject(protoObj, _.identity), {a: 1}, 'ignore inherited values from prototyp…