mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-08 10:17:48 +00:00
Tweak var names in _.once tests.
This commit is contained in:
20
test/test.js
20
test/test.js
@@ -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;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user