mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-09 02:17:50 +00:00
Use _.noop more in test/test.js.
This commit is contained in:
32
test/test.js
32
test/test.js
@@ -3134,7 +3134,7 @@
|
|||||||
|
|
||||||
test('`_.' + methodName + '` should return a wrapped value when chaining', 1, function() {
|
test('`_.' + methodName + '` should return a wrapped value when chaining', 1, function() {
|
||||||
if (!isNpm) {
|
if (!isNpm) {
|
||||||
var actual = _(array)[methodName](noop);
|
var actual = _(array)[methodName](_.noop);
|
||||||
ok(actual instanceof _);
|
ok(actual instanceof _);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@@ -3168,7 +3168,7 @@
|
|||||||
test('`_.' + methodName + '` should return the existing wrapper when chaining', 1, function() {
|
test('`_.' + methodName + '` should return the existing wrapper when chaining', 1, function() {
|
||||||
if (!isNpm) {
|
if (!isNpm) {
|
||||||
var wrapper = _(array);
|
var wrapper = _(array);
|
||||||
strictEqual(wrapper[methodName](noop), wrapper);
|
strictEqual(wrapper[methodName](_.noop), wrapper);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
skipTest();
|
skipTest();
|
||||||
@@ -3457,7 +3457,7 @@
|
|||||||
this.a = _.identity;
|
this.a = _.identity;
|
||||||
this.b = 'b'
|
this.b = 'b'
|
||||||
}
|
}
|
||||||
Foo.prototype.c = noop;
|
Foo.prototype.c = _.noop;
|
||||||
deepEqual(_.functions(new Foo), ['a', 'c']);
|
deepEqual(_.functions(new Foo), ['a', 'c']);
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -4003,7 +4003,7 @@
|
|||||||
strictEqual(_.isArguments(true), false);
|
strictEqual(_.isArguments(true), false);
|
||||||
strictEqual(_.isArguments(new Date), false);
|
strictEqual(_.isArguments(new Date), false);
|
||||||
strictEqual(_.isArguments(_), false);
|
strictEqual(_.isArguments(_), false);
|
||||||
strictEqual(_.isArguments({ '0': 1, 'callee': noop, 'length': 1 }), false);
|
strictEqual(_.isArguments({ '0': 1, 'callee': _.noop, 'length': 1 }), false);
|
||||||
strictEqual(_.isArguments(0), false);
|
strictEqual(_.isArguments(0), false);
|
||||||
strictEqual(_.isArguments(/x/), false);
|
strictEqual(_.isArguments(/x/), false);
|
||||||
strictEqual(_.isArguments('a'), false);
|
strictEqual(_.isArguments('a'), false);
|
||||||
@@ -4430,7 +4430,7 @@
|
|||||||
'f': ['a', new String('b'), 'c'],
|
'f': ['a', new String('b'), 'c'],
|
||||||
'g': new Boolean(false),
|
'g': new Boolean(false),
|
||||||
'h': new Date(2012, 4, 23),
|
'h': new Date(2012, 4, 23),
|
||||||
'i': noop,
|
'i': _.noop,
|
||||||
'j': 'a'
|
'j': 'a'
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -4444,7 +4444,7 @@
|
|||||||
'f': ['a', 'b', 'c'],
|
'f': ['a', 'b', 'c'],
|
||||||
'g': false,
|
'g': false,
|
||||||
'h': new Date(2012, 4, 23),
|
'h': new Date(2012, 4, 23),
|
||||||
'i': noop,
|
'i': _.noop,
|
||||||
'j': 'a'
|
'j': 'a'
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -5712,7 +5712,7 @@
|
|||||||
|
|
||||||
test('should return a wrapped value when chaining', 1, function() {
|
test('should return a wrapped value when chaining', 1, function() {
|
||||||
if (!isNpm) {
|
if (!isNpm) {
|
||||||
ok(_(array).map(noop) instanceof _);
|
ok(_(array).map(_.noop) instanceof _);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
skipTest();
|
skipTest();
|
||||||
@@ -5796,7 +5796,7 @@
|
|||||||
|
|
||||||
test('should return a wrapped value when chaining', 1, function() {
|
test('should return a wrapped value when chaining', 1, function() {
|
||||||
if (!isNpm) {
|
if (!isNpm) {
|
||||||
ok(_(object).mapValues(noop) instanceof _);
|
ok(_(object).mapValues(_.noop) instanceof _);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
skipTest();
|
skipTest();
|
||||||
@@ -7369,7 +7369,7 @@
|
|||||||
|
|
||||||
_.each(empties, function(value) {
|
_.each(empties, function(value) {
|
||||||
try {
|
try {
|
||||||
actual.push(func(value, noop));
|
actual.push(func(value, _.noop));
|
||||||
} catch(e) { }
|
} catch(e) { }
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -7381,7 +7381,7 @@
|
|||||||
|
|
||||||
var actual = _.map(empties, function(value) {
|
var actual = _.map(empties, function(value) {
|
||||||
try {
|
try {
|
||||||
return func(value, noop, 'x');
|
return func(value, _.noop, 'x');
|
||||||
} catch(e) { }
|
} catch(e) { }
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -7389,7 +7389,7 @@
|
|||||||
});
|
});
|
||||||
|
|
||||||
test('`_.' + methodName + '` should handle an initial `accumulator` value of `undefined`', 1, function() {
|
test('`_.' + methodName + '` should handle an initial `accumulator` value of `undefined`', 1, function() {
|
||||||
var actual = func([], noop, undefined);
|
var actual = func([], _.noop, undefined);
|
||||||
strictEqual(actual, undefined);
|
strictEqual(actual, undefined);
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -7399,12 +7399,12 @@
|
|||||||
|
|
||||||
if ('__proto__' in array) {
|
if ('__proto__' in array) {
|
||||||
array.__proto__ = object;
|
array.__proto__ = object;
|
||||||
strictEqual(_.reduce(array, noop), undefined);
|
strictEqual(_.reduce(array, _.noop), undefined);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
skipTest();
|
skipTest();
|
||||||
}
|
}
|
||||||
strictEqual(_.reduce(object, noop), undefined);
|
strictEqual(_.reduce(object, _.noop), undefined);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -9039,7 +9039,7 @@
|
|||||||
var pass = true;
|
var pass = true;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
func(noop, 32, 1);
|
func(_.noop, 32, 1);
|
||||||
} catch(e) {
|
} catch(e) {
|
||||||
pass = false;
|
pass = false;
|
||||||
}
|
}
|
||||||
@@ -9678,12 +9678,12 @@
|
|||||||
test('should pass the correct `wrapper` arguments', 1, function() {
|
test('should pass the correct `wrapper` arguments', 1, function() {
|
||||||
var args;
|
var args;
|
||||||
|
|
||||||
var wrapped = _.wrap(noop, function() {
|
var wrapped = _.wrap(_.noop, function() {
|
||||||
args || (args = slice.call(arguments));
|
args || (args = slice.call(arguments));
|
||||||
});
|
});
|
||||||
|
|
||||||
wrapped(1, 2, 3);
|
wrapped(1, 2, 3);
|
||||||
deepEqual(args, [noop, 1, 2, 3]);
|
deepEqual(args, [_.noop, 1, 2, 3]);
|
||||||
});
|
});
|
||||||
|
|
||||||
test('should not set a `this` binding', 1, function() {
|
test('should not set a `this` binding', 1, function() {
|
||||||
|
|||||||
Reference in New Issue
Block a user