|
15 | 15 | deepEqual(_.keys(1), []); |
16 | 16 | deepEqual(_.keys('a'), []); |
17 | 17 | deepEqual(_.keys(true), []); |
18 | | - |
19 | | - // keys that may be missed if the implementation isn't careful |
20 | | - var trouble = { |
21 | | - 'constructor': Object, |
22 | | - 'valueOf': _.noop, |
23 | | - 'hasOwnProperty': null, |
24 | | - 'toString': 5, |
25 | | - 'toLocaleString': undefined, |
26 | | - 'propertyIsEnumerable': /a/, |
27 | | - 'isPrototypeOf': this, |
28 | | - '__defineGetter__': Boolean, |
29 | | - '__defineSetter__': {}, |
30 | | - '__lookupSetter__': false, |
31 | | - '__lookupGetter__': [] |
32 | | - }; |
33 | | - var troubleKeys = ['constructor', 'valueOf', 'hasOwnProperty', 'toString', 'toLocaleString', 'propertyIsEnumerable', |
34 | | - 'isPrototypeOf', '__defineGetter__', '__defineSetter__', '__lookupSetter__', '__lookupGetter__'].sort(); |
35 | | - deepEqual(_.keys(trouble).sort(), troubleKeys, 'matches non-enumerable properties'); |
36 | 18 | }); |
37 | 19 |
|
38 | 20 | test('allKeys', function() { |
|
48 | 30 | deepEqual(_.allKeys(val), []); |
49 | 31 | }); |
50 | 32 |
|
51 | | - // allKeys that may be missed if the implementation isn't careful |
52 | | - var trouble = { |
53 | | - constructor: Object, |
54 | | - valueOf: _.noop, |
55 | | - hasOwnProperty: null, |
56 | | - toString: 5, |
57 | | - toLocaleString: undefined, |
58 | | - propertyIsEnumerable: /a/, |
59 | | - isPrototypeOf: this |
60 | | - }; |
61 | | - var troubleKeys = ['constructor', 'valueOf', 'hasOwnProperty', 'toString', 'toLocaleString', 'propertyIsEnumerable', |
62 | | - 'isPrototypeOf'].sort(); |
63 | | - deepEqual(_.allKeys(trouble).sort(), troubleKeys, 'matches non-enumerable properties'); |
64 | | - |
65 | 33 | function A() {} |
66 | 34 | A.prototype.foo = 'foo'; |
67 | 35 | var b = new A(); |
68 | 36 | b.bar = 'bar'; |
69 | | - deepEqual(_.allKeys(b), ['bar', 'foo'], 'should include inherited keys'); |
| 37 | + deepEqual(_.allKeys(b).sort(), ['bar', 'foo'], 'should include inherited keys'); |
70 | 38 |
|
71 | 39 | function y() {} |
72 | 40 | y.x = 'z'; |
|
543 | 511 | var args = function(){ return arguments; }; |
544 | 512 | ok(_.isEmpty(args()), 'empty arguments object is empty'); |
545 | 513 | ok(!_.isEmpty(args('')), 'non-empty arguments object is not empty'); |
546 | | - |
547 | | - // covers collecting non-enumerable properties in IE < 9 |
548 | | - var nonEnumProp = {'toString': 5}; |
549 | | - ok(!_.isEmpty(nonEnumProp), 'non-enumerable property is not empty'); |
550 | 514 | }); |
551 | 515 |
|
552 | 516 | if (typeof document === 'object') { |
|
772 | 736 |
|
773 | 737 | Prototest.x = 5; |
774 | 738 | ok(_.isMatch({x: 5, y: 1}, Prototest), 'spec can be a function'); |
775 | | - |
776 | | - //null edge cases |
777 | | - var oCon = {'constructor': Object}; |
778 | | - deepEqual(_.map([null, undefined, 5, {}], _.partial(_.isMatch, _, oCon)), [false, false, false, true], 'doesnt fasley match constructor on undefined/null'); |
779 | 739 | }); |
780 | 740 |
|
781 | 741 | test('matcher', function() { |
|
828 | 788 | o.b = 2; |
829 | 789 | o.a = 1; |
830 | 790 | equal(m({'b': 1}), true, 'changing spec object doesnt change matches result'); |
831 | | - |
832 | | - |
833 | | - //null edge cases |
834 | | - var oCon = _.matcher({'constructor': Object}); |
835 | | - deepEqual(_.map([null, undefined, 5, {}], oCon), [false, false, false, true], 'doesnt fasley match constructor on undefined/null'); |
836 | 791 | }); |
837 | 792 |
|
838 | 793 | test('matcher', function() { |
|
885 | 840 | o.b = 2; |
886 | 841 | o.a = 1; |
887 | 842 | equal(m({'b': 1}), true, 'changing spec object doesnt change matches result'); |
888 | | - |
889 | | - |
890 | | - //null edge cases |
891 | | - var oCon = _.matcher({'constructor': Object}); |
892 | | - deepEqual(_.map([null, undefined, 5, {}], oCon), [false, false, false, true], 'doesnt fasley match constructor on undefined/null'); |
893 | 843 | }); |
894 | 844 |
|
895 | 845 | test('findKey', function() { |
|
0 commit comments