mirror of https://github.com/lukechilds/node.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
26 lines
400 B
26 lines
400 B
11 years ago
|
var test = require('tap').test
|
||
|
var dz = require('../dezalgo.js')
|
||
|
|
||
|
test('the dark pony', function(t) {
|
||
|
|
||
|
var n = 0
|
||
|
function foo(cb) {
|
||
|
cb = dz(cb)
|
||
|
if (++n % 2) cb()
|
||
|
else process.nextTick(cb)
|
||
|
}
|
||
|
|
||
|
var called = 0
|
||
|
for (var i = 0; i < 10; i++) {
|
||
|
foo(function() {
|
||
|
called++
|
||
|
})
|
||
|
t.equal(called, 0)
|
||
|
}
|
||
|
|
||
|
setTimeout(function() {
|
||
|
t.equal(called, 10)
|
||
|
t.end()
|
||
|
})
|
||
|
})
|