Skip to content

Commit

Permalink
add memoize correctness test
Browse files Browse the repository at this point in the history
  • Loading branch information
Aleksey Smolenchuk committed Jul 7, 2014
1 parent 2321212 commit 2de849f
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions test/test-async.js
Original file line number Diff line number Diff line change
Expand Up @@ -2855,7 +2855,7 @@ exports['cargo drain twice'] = function (test) {
};

exports['memoize'] = function (test) {
test.expect(4);
test.expect(5);
var call_order = [];

var fn = function (arg1, arg2, callback) {
Expand All @@ -2870,10 +2870,13 @@ exports['memoize'] = function (test) {
test.equal(result, 3);
fn2(1, 2, function (err, result) {
test.equal(result, 3);
fn2(2, 2, function (err, result) {
fn2(1, 3, function (err, result) {
test.equal(result, 4);
test.same(call_order, [['fn',1,2], ['fn',2,2]]);
test.done();
fn2(2, 2, function (err, result) {
test.equal(result, 4);
test.same(call_order, [['fn',1,2], ['fn',1,3], ['fn',2,2]]);
test.done();
});
});
});
});
Expand Down

0 comments on commit 2de849f

Please sign in to comment.