Created
March 22, 2010 07:34
-
-
Save billywhizz/339870 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require("../common"); | |
var path = require('path'); | |
var fs = require('fs'); | |
var got_error = false; | |
var success_count = 0; | |
var file = path.join(fixturesDir, "a.js"); | |
fs.open(file, process.O_WRONLY | process.O_APPEND, 0777, function (err, fd) { | |
try { | |
if(err) { | |
got_error = true; | |
} | |
else { | |
if(typeof(fs.fdatasyncSync(fd)) == "undefined") { | |
puts("fdatasync SYNC: ok"); | |
success_count++; | |
} | |
else { | |
got_error = true; | |
} | |
if(typeof(fs.fsyncSync(fd)) == "undefined") { | |
puts("fsync SYNC: ok"); | |
success_count++; | |
} | |
else { | |
got_error = true; | |
} | |
fs.fdatasync(fd, function(err) { | |
if(err) { | |
got_error = true; | |
} | |
else { | |
puts("fdatasync ASYNC: ok"); | |
success_count++; | |
} | |
fs.fsync(fd, function(err) { | |
if(err) { | |
got_error = true; | |
} | |
else { | |
puts("fsync ASYNC: ok"); | |
success_count++; | |
} | |
}); | |
}); | |
} | |
} | |
catch(e) { | |
got_error = true; | |
} | |
}); | |
process.addListener("exit", function () { | |
assert.equal(4, success_count); | |
assert.equal(false, got_error); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment