~ubuntu-branches/ubuntu/precise/nodejs/precise

« back to all changes in this revision

Viewing changes to test/pummel/test-watch-file.js

  • Committer: Bazaar Package Importer
  • Author(s): Jérémy Lal
  • Date: 2010-08-20 11:49:04 UTC
  • mfrom: (7.1.6 sid)
  • Revision ID: james.westby@ubuntu.com-20100820114904-lz22w6fkth7yh179
Tags: 0.2.0-1
New upstream release

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
require("../common");
 
1
common = require("../common");
 
2
assert = common.assert
2
3
 
3
4
var fs = require("fs");
4
5
var path = require("path");
5
6
 
6
 
var f = path.join(fixturesDir, "x.txt");
7
 
var f2 = path.join(fixturesDir, "x2.txt");
 
7
var f = path.join(common.fixturesDir, "x.txt");
 
8
var f2 = path.join(common.fixturesDir, "x2.txt");
8
9
 
9
 
puts("watching for changes of " + f);
 
10
console.log("watching for changes of " + f);
10
11
 
11
12
var changes = 0;
12
13
function watchFile () {
13
14
  fs.watchFile(f, function (curr, prev) {
14
 
    puts(f + " change");
 
15
    console.log(f + " change");
15
16
    changes++;
16
17
    assert.ok(curr.mtime != prev.mtime);
17
18
    fs.unwatchFile(f);