diff options
author | iamdoron <doronpagot@gmail.com> | 2014-02-06 08:29:58 +0200 |
---|---|---|
committer | Fedor Indutny <fedor.indutny@gmail.com> | 2014-02-06 13:04:35 +0400 |
commit | 1317032c9738790362b8e1bdd3638f1368b00188 (patch) | |
tree | 012b7c86363f325180f5176155c6210544f19550 /test/pummel | |
parent | d2147c55c25410e1666ee75360d918f973e25842 (diff) | |
download | nodejs-1317032c9738790362b8e1bdd3638f1368b00188.tar.gz nodejs-1317032c9738790362b8e1bdd3638f1368b00188.tar.bz2 nodejs-1317032c9738790362b8e1bdd3638f1368b00188.zip |
fs: make unwatchFile() insensitive to path
Diffstat (limited to 'test/pummel')
-rw-r--r-- | test/pummel/test-fs-watch-file.js | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/test/pummel/test-fs-watch-file.js b/test/pummel/test-fs-watch-file.js index 4dddb257e..3e8a17a4b 100644 --- a/test/pummel/test-fs-watch-file.js +++ b/test/pummel/test-fs-watch-file.js @@ -27,6 +27,7 @@ var fs = require('fs'); var watchSeenOne = 0; var watchSeenTwo = 0; var watchSeenThree = 0; +var watchSeenFour = 0; var startDir = process.cwd(); var testDir = common.tmpDir; @@ -40,14 +41,17 @@ var filepathTwoAbs = path.join(testDir, filenameTwo); var filenameThree = 'charm'; // because the third time is +var filenameFour = 'get'; process.on('exit', function() { fs.unlinkSync(filepathOne); fs.unlinkSync(filepathTwoAbs); fs.unlinkSync(filenameThree); + fs.unlinkSync(filenameFour); assert.equal(1, watchSeenOne); assert.equal(2, watchSeenTwo); assert.equal(1, watchSeenThree); + assert.equal(1, watchSeenFour); }); @@ -126,3 +130,22 @@ assert.doesNotThrow( setTimeout(function() { fs.writeFileSync(filenameThree, 'pardner'); }, 1000); + +setTimeout(function() { + fs.writeFileSync(filenameFour, 'hey'); +}, 200); + +setTimeout(function() { + fs.writeFileSync(filenameFour, 'hey'); +}, 500); + +assert.doesNotThrow( + function() { + function a(curr, prev) { + ++watchSeenFour; + assert.equal(1, watchSeenFour); + fs.unwatchFile("." + path.sep + filenameFour, a); + } + fs.watchFile(filenameFour, a); + } +); |