2009-06-08 21:30:10 +08:00
|
|
|
include("mjsunit.js");
|
2009-06-09 01:10:23 +08:00
|
|
|
|
|
|
|
var got_error = false;
|
|
|
|
var opened = false;
|
|
|
|
var closed = false;
|
2009-04-21 19:52:21 +08:00
|
|
|
|
2009-04-21 22:30:47 +08:00
|
|
|
function onLoad () {
|
|
|
|
var dirname = node.path.dirname(__filename);
|
|
|
|
var fixtures = node.path.join(dirname, "fixtures");
|
2009-04-21 19:52:21 +08:00
|
|
|
var x = node.path.join(fixtures, "x.txt");
|
|
|
|
|
2009-05-21 18:49:41 +08:00
|
|
|
file = new node.fs.File;
|
2009-07-01 06:49:56 +08:00
|
|
|
file.addListener("error", function () { got_error = true; });
|
2009-05-25 19:17:35 +08:00
|
|
|
|
2009-06-29 01:05:58 +08:00
|
|
|
file.open(x, "r").addCallback(function () {
|
2009-07-01 06:49:56 +08:00
|
|
|
opened = true;
|
2009-06-29 01:05:58 +08:00
|
|
|
file.close().addCallback(function () {
|
2009-06-09 01:10:23 +08:00
|
|
|
closed = true;
|
|
|
|
});
|
2009-04-21 19:52:21 +08:00
|
|
|
});
|
2009-06-29 01:05:58 +08:00
|
|
|
|
|
|
|
puts("hey!");
|
2009-06-09 01:10:23 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
function onExit () {
|
|
|
|
assertFalse(got_error);
|
|
|
|
assertTrue(opened);
|
|
|
|
assertTrue(closed);
|
|
|
|
}
|