0
0
mirror of https://github.com/nodejs/node.git synced 2024-12-01 16:10:02 +01:00
nodejs/test/test-file-open.js
Ryan 8b49cef10b Modify the tests to use onExit hook.
No need to rely on stdout output now.
onExit callbacks should print stack trace from onExit failure
2009-06-08 19:10:36 +02:00

28 lines
547 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.onError = function () { got_error = true };
file.open(x, "r", function () {
opened = true
file.close(function () {
closed = true;
});
});
}
function onExit () {
assertFalse(got_error);
assertTrue(opened);
assertTrue(closed);
}