2009-10-31 18:02:30 +00:00
|
|
|
process.mixin(require("./common"));
|
2009-09-17 06:28:31 +00:00
|
|
|
|
2009-10-31 18:02:30 +00:00
|
|
|
var fn = path.join(fixturesDir, "write.txt");
|
2009-09-17 06:28:31 +00:00
|
|
|
var expected = "hello";
|
|
|
|
var found;
|
|
|
|
|
2010-02-17 07:06:26 +00:00
|
|
|
fs.open(fn, 'w', 0644).addCallback(function (file) {
|
2010-02-12 09:04:14 +00:00
|
|
|
fs.write(file, expected, 0, "utf8").addCallback(function() {
|
|
|
|
fs.close(file).addCallback(function() {
|
2010-02-17 07:06:26 +00:00
|
|
|
fs.readFile(fn, process.UTF8).addCallback(function(contents) {
|
2009-09-17 06:28:31 +00:00
|
|
|
found = contents;
|
2010-02-18 05:28:31 +00:00
|
|
|
fs.unlinkSync(fn);
|
2009-09-17 06:28:31 +00:00
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
process.addListener("exit", function () {
|
2009-11-28 17:26:59 +00:00
|
|
|
assert.equal(expected, found);
|
2009-09-17 06:28:31 +00:00
|
|
|
});
|
|
|
|
|