Allow _.attempt to provide additional arguments to func. [closes #929]

This commit is contained in:
jdalton
2015-02-06 23:09:52 -08:00
parent 82c7a22d27
commit 5ab79f292b
2 changed files with 16 additions and 11 deletions

View File

@@ -1076,6 +1076,11 @@
strictEqual(_.attempt(_.constant('x')), 'x');
});
test('should provide additional arguments to `func`', 1, function() {
var actual = _.attempt(function() { return slice.call(arguments); }, 1, 2);
deepEqual(actual, [1, 2]);
});
test('should return the caught error', 1, function() {
var expected = _.map(errors, _.constant(true));
@@ -3378,16 +3383,16 @@
}
});
asyncTest('should accept additional arguments', 1, function() {
asyncTest('should provide additional arguments to `func`', 1, function() {
if (!(isRhino && isModularize)) {
var args;
_.defer(function() {
args = slice.call(arguments);
}, 1, 2, 3);
}, 1, 2);
setTimeout(function() {
deepEqual(args, [1, 2, 3]);
deepEqual(args, [1, 2]);
QUnit.start();
}, 128);
}
@@ -3444,16 +3449,16 @@
}
});
asyncTest('should accept additional arguments', 1, function() {
asyncTest('should provide additional arguments to `func`', 1, function() {
if (!(isRhino && isModularize)) {
var args;
_.delay(function() {
args = slice.call(arguments);
}, 32, 1, 2, 3);
}, 32, 1, 2);
setTimeout(function() {
deepEqual(args, [1, 2, 3]);
deepEqual(args, [1, 2]);
QUnit.start();
}, 128);
}