node/test/pummel/test-timer-wrap.js

20 lines
326 B
JavaScript
Raw Normal View History

2011-05-26 01:16:36 +08:00
var common = require('../common');
var assert = require('assert');
var timeouts = 0;
2011-05-26 01:16:36 +08:00
var Timer = process.binding('timer_wrap').Timer;
var t = new Timer();
t.start(1000, 0);
2011-05-26 01:16:36 +08:00
t.ontimeout = function() {
timeouts++;
2011-05-26 01:16:36 +08:00
console.log('timeout');
t.close();
};
process.on('exit', function() {
assert.equal(1, timeouts);
});