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