mirror of
https://github.com/nodejs/node.git
synced 2024-11-29 23:16:30 +01:00
b6fe4aec50
There is one major API change in the refactor: filename extensions are now required when requiring or including modules. Added extra test to test-module-loading.js.
32 lines
780 B
JavaScript
32 lines
780 B
JavaScript
include("mjsunit.js");
|
|
|
|
function onLoad () {
|
|
assertInstanceof(setTimeout, Function);
|
|
var starttime = new Date;
|
|
|
|
setTimeout(function () {
|
|
var endtime = new Date;
|
|
var diff = endtime - starttime;
|
|
if (diff < 0) diff = -diff;
|
|
assertTrue(900 < diff || diff < 1100);
|
|
}, 1000);
|
|
|
|
// this timer shouldn't execute
|
|
var id = setTimeout(function () { assertTrue(false); }, 500);
|
|
clearTimeout(id);
|
|
|
|
var count = 0;
|
|
setInterval(function () {
|
|
count += 1;
|
|
var endtime = new Date;
|
|
var diff = endtime - starttime;
|
|
if (diff < 0) diff = -diff;
|
|
puts(diff);
|
|
var t = count * 1000;
|
|
assertTrue(t - 100 < diff || diff < t + 100);
|
|
assertTrue(count <= 3);
|
|
if (count == 3)
|
|
clearInterval(this);
|
|
}, 1000);
|
|
}
|