Tweak var names in _.once tests.

This commit is contained in:
John-David Dalton
2014-03-29 12:55:19 -07:00
parent 141227d846
commit ae8796a570

View File

@@ -6101,16 +6101,16 @@
(function() { (function() {
test('should execute `func` once', 1, function() { test('should execute `func` once', 1, function() {
var count = 0, var count = 0,
func = _.once(function() { count++; }); once = _.once(function() { count++; });
func(); once();
func(); once();
strictEqual(count, 1); strictEqual(count, 1);
}); });
test('should not set a `this` binding', 1, function() { test('should not set a `this` binding', 1, function() {
var func = _.once(function() { this.count++; }), var once = _.once(function() { this.count++; }),
object = { 'count': 0, 'once': func }; object = { 'count': 0, 'once': once };
object.once(); object.once();
object.once(); object.once();
@@ -6120,26 +6120,26 @@
test('should ignore recursive calls', 1, function() { test('should ignore recursive calls', 1, function() {
var count = 0; var count = 0;
var func = _.once(function() { var once = _.once(function() {
count++; count++;
func(); func();
}); });
func(); once();
strictEqual(count, 1); strictEqual(count, 1);
}); });
test('should not throw more than once', 2, function() { test('should not throw more than once', 2, function() {
var pass = true; var pass = true;
var func = _.once(function() { var once = _.once(function() {
throw new Error; throw new Error;
}); });
raises(function() { func(); }, Error); raises(function() { once(); }, Error);
try { try {
func(); once();
} catch(e) { } catch(e) {
pass = false; pass = false;
} }