mirror of https://github.com/lukechilds/node.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
26 lines
620 B
26 lines
620 B
15 years ago
|
process.mixin(require("../common"));
|
||
16 years ago
|
|
||
15 years ago
|
var fn = path.join(fixturesDir, "write.txt");
|
||
16 years ago
|
var expected = "hello";
|
||
|
var found;
|
||
|
|
||
15 years ago
|
fs.open(fn, 'w', 0644, function (err, fd) {
|
||
|
if (err) throw err;
|
||
|
puts('open done');
|
||
|
fs.write(fd, expected, 0, "utf8", function (err, written) {
|
||
|
puts('write done');
|
||
|
if (err) throw err;
|
||
|
assert.equal(expected.length, written);
|
||
|
fs.closeSync(fd);
|
||
|
found = fs.readFileSync(fn, 'utf8');
|
||
|
puts('expected: ' + expected.toJSON());
|
||
|
puts('found: ' + found.toJSON());
|
||
|
fs.unlinkSync(fn);
|
||
16 years ago
|
});
|
||
|
});
|
||
|
|
||
|
process.addListener("exit", function () {
|
||
15 years ago
|
assert.equal(expected, found);
|
||
16 years ago
|
});
|
||
|
|