0
0
mirror of https://github.com/nodejs/node.git synced 2024-12-01 16:10:02 +01:00
nodejs/test/mjsunit/test-file-open.js
Joshaven Potter 4b9f26c51a validate js
2009-07-01 02:33:08 +02:00

30 lines
604 B
JavaScript

include("mjsunit.js");
var got_error = false;
var opened = false;
var closed = false;
function onLoad () {
var dirname = node.path.dirname(__filename);
var fixtures = node.path.join(dirname, "fixtures");
var x = node.path.join(fixtures, "x.txt");
file = new node.fs.File;
file.addListener("error", function () { got_error = true; });
file.open(x, "r").addCallback(function () {
opened = true;
file.close().addCallback(function () {
closed = true;
});
});
puts("hey!");
}
function onExit () {
assertFalse(got_error);
assertTrue(opened);
assertTrue(closed);
}