2009-11-01 02:02:30 +08:00
|
|
|
process.mixin(require("./common"));
|
2009-09-17 14:28:31 +08:00
|
|
|
|
2009-11-01 02:02:30 +08:00
|
|
|
var fn = path.join(fixturesDir, "write.txt");
|
2009-09-17 14:28:31 +08:00
|
|
|
var expected = "hello";
|
|
|
|
var found;
|
|
|
|
|
2009-11-01 02:02:30 +08:00
|
|
|
posix.open(fn, process.O_WRONLY | process.O_TRUNC | process.O_CREAT, 0644).addCallback(function (file) {
|
2009-10-29 05:45:40 +08:00
|
|
|
posix.write(file, expected, 0, "utf8").addCallback(function() {
|
|
|
|
posix.close(file).addCallback(function() {
|
2009-11-01 02:02:30 +08:00
|
|
|
posix.cat(fn, process.UTF8).addCallback(function(contents) {
|
2009-09-17 14:28:31 +08:00
|
|
|
found = contents;
|
2009-11-01 02:02:30 +08:00
|
|
|
posix.unlink(fn).wait();
|
2009-09-17 14:28:31 +08:00
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
process.addListener("exit", function () {
|
2009-11-29 01:26:59 +08:00
|
|
|
assert.equal(expected, found);
|
2009-09-17 14:28:31 +08:00
|
|
|
});
|
|
|
|
|