2009-11-17 14:07:48 +01:00
|
|
|
process.mixin(require("./common"));
|
|
|
|
|
|
|
|
var path = require("path");
|
|
|
|
|
|
|
|
var f = path.join(fixturesDir, "x.txt");
|
|
|
|
var f2 = path.join(fixturesDir, "x2.txt");
|
|
|
|
|
2009-11-17 14:52:18 +01:00
|
|
|
puts("watching for changes of " + f);
|
|
|
|
|
2009-11-17 14:07:48 +01:00
|
|
|
var changes = 0;
|
2009-11-28 14:52:27 +01:00
|
|
|
process.watchFile(f, function (curr, prev) {
|
2009-11-17 14:07:48 +01:00
|
|
|
puts(f + " change");
|
|
|
|
changes++;
|
2009-11-28 18:26:59 +01:00
|
|
|
assert.equal(true, curr.mtime != prev.mtime);
|
2009-11-17 14:52:18 +01:00
|
|
|
process.unwatchFile(f);
|
2009-11-17 14:07:48 +01:00
|
|
|
});
|
|
|
|
|
|
|
|
|
2009-11-17 14:52:18 +01:00
|
|
|
var File = require("file").File;
|
|
|
|
|
|
|
|
var file = new File(f, 'w+');
|
|
|
|
file.write('xyz\n');
|
|
|
|
file.close().wait();
|
2009-11-17 14:07:48 +01:00
|
|
|
|
|
|
|
|
|
|
|
process.addListener("exit", function () {
|
2009-11-28 18:26:59 +01:00
|
|
|
assert.equal(true, changes > 0);
|
2009-11-17 14:07:48 +01:00
|
|
|
});
|