Skip to content

Commit

Permalink
Fix jashkenas#1058 - Add test for recursive onced functions.
Browse files Browse the repository at this point in the history
  • Loading branch information
braddunbar committed Apr 9, 2013
1 parent 6d60507 commit a9c9dea
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions test/functions.js
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,14 @@ $(document).ready(function() {
equal(num, 1);
});

test("Recursive onced function.", 1, function() {
var f = _.once(function(){
ok(true);
f();
});
f();
});

test("wrap", function() {
var greet = function(name){ return "hi: " + name; };
var backwards = _.wrap(greet, function(func, name){ return func(name) + ' ' + name.split('').reverse().join(''); });
Expand Down

0 comments on commit a9c9dea

Please sign in to comment.