0
0
mirror of https://github.com/nodejs/node.git synced 2024-11-30 15:30:56 +01:00
nodejs/test/mjsunit/test-stat-handler.js
Felix Geisendörfer 530328f12b CommonJS testing for node.js
Refactored test suite to use the assert module for testing rather than
mjsunit.
2009-12-05 01:05:16 +01:00

29 lines
557 B
JavaScript

process.mixin(require("./common"));
var path = require("path");
var f = path.join(fixturesDir, "x.txt");
var f2 = path.join(fixturesDir, "x2.txt");
puts("watching for changes of " + f);
var changes = 0;
process.watchFile(f, function (curr, prev) {
puts(f + " change");
changes++;
assert.equal(true, curr.mtime != prev.mtime);
process.unwatchFile(f);
});
var File = require("file").File;
var file = new File(f, 'w+');
file.write('xyz\n');
file.close().wait();
process.addListener("exit", function () {
assert.equal(true, changes > 0);
});