mirror of
https://github.com/nodejs/node.git
synced 2025-05-19 11:32:42 +00:00

Remove unused vars in tests PR-URL: https://github.com/nodejs/node/pull/4536 Reviewed-By: Rod Vagg <rod@vagg.org> Reviewed-By: Michaël Zasso <mic.besace@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
34 lines
625 B
JavaScript
34 lines
625 B
JavaScript
'use strict';
|
|
var common = require('../common');
|
|
var assert = require('assert');
|
|
|
|
var fs = require('fs');
|
|
var path = require('path');
|
|
|
|
var f = path.join(common.fixturesDir, 'x.txt');
|
|
|
|
console.log('watching for changes of ' + f);
|
|
|
|
var changes = 0;
|
|
function watchFile() {
|
|
fs.watchFile(f, function(curr, prev) {
|
|
console.log(f + ' change');
|
|
changes++;
|
|
assert.ok(curr.mtime != prev.mtime);
|
|
fs.unwatchFile(f);
|
|
watchFile();
|
|
fs.unwatchFile(f);
|
|
});
|
|
}
|
|
|
|
watchFile();
|
|
|
|
|
|
var fd = fs.openSync(f, 'w+');
|
|
fs.writeSync(fd, 'xyz\n');
|
|
fs.closeSync(fd);
|
|
|
|
process.on('exit', function() {
|
|
assert.ok(changes > 0);
|
|
});
|