summaryrefslogtreecommitdiff
path: root/test/pummel/test-watch-file.js
diff options
context:
space:
mode:
authorarlolra <arlolra@gmail.com>2010-02-25 01:36:17 -0500
committerRyan Dahl <ry@tinyclouds.org>2010-02-25 11:41:11 -0800
commit04fac198225ae48ed7726c15609d254fddce4862 (patch)
treeb09866cfed0c40d4cd3731f1d8b161e335df17e0 /test/pummel/test-watch-file.js
parent9ad7539cf9c36edf4b014adb1ce979f578de0aa1 (diff)
downloadandroid-node-v8-04fac198225ae48ed7726c15609d254fddce4862.tar.gz
android-node-v8-04fac198225ae48ed7726c15609d254fddce4862.tar.bz2
android-node-v8-04fac198225ae48ed7726c15609d254fddce4862.zip
Split tests.
Diffstat (limited to 'test/pummel/test-watch-file.js')
-rw-r--r--test/pummel/test-watch-file.js27
1 files changed, 27 insertions, 0 deletions
diff --git a/test/pummel/test-watch-file.js b/test/pummel/test-watch-file.js
new file mode 100644
index 0000000000..1c235d6d17
--- /dev/null
+++ b/test/pummel/test-watch-file.js
@@ -0,0 +1,27 @@
+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.ok(curr.mtime != prev.mtime);
+ process.unwatchFile(f);
+});
+
+
+var fs = require("fs");
+
+var fd = fs.openSync(f, "w+");
+fs.writeSync(fd, 'xyz\n');
+fs.closeSync(fd);
+
+process.addListener("exit", function () {
+ assert.ok(changes > 0);
+});