2009-10-30 06:34:10 +08:00
|
|
|
process.mixin(require("common.js"));
|
2009-09-17 14:28:31 +08:00
|
|
|
|
2009-10-30 06:34:10 +08:00
|
|
|
var path = process.path.join(fixturesDir, "write.txt");
|
2009-09-17 14:28:31 +08:00
|
|
|
var expected = "hello";
|
|
|
|
var found;
|
|
|
|
|
2009-10-30 06:34:10 +08:00
|
|
|
posix.open(path, 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-10-30 06:34:10 +08:00
|
|
|
posix.cat(path, process.UTF8).addCallback(function(contents) {
|
2009-09-17 14:28:31 +08:00
|
|
|
found = contents;
|
2009-10-29 05:45:40 +08:00
|
|
|
posix.unlink(path).wait();
|
2009-09-17 14:28:31 +08:00
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
process.addListener("exit", function () {
|
|
|
|
assertEquals(expected, found);
|
|
|
|
});
|
|
|
|
|