2009-10-31 19:02:30 +01:00
|
|
|
process.mixin(require("./common"));
|
2009-06-29 14:11:26 +02:00
|
|
|
|
|
|
|
var got_error = false;
|
2009-09-11 13:41:47 +02:00
|
|
|
var success_count = 0;
|
2009-06-29 14:11:26 +02:00
|
|
|
var stats;
|
|
|
|
|
2009-10-28 22:45:40 +01:00
|
|
|
var promise = posix.stat(".");
|
2009-06-29 14:11:26 +02:00
|
|
|
|
|
|
|
promise.addCallback(function (_stats) {
|
|
|
|
stats = _stats;
|
|
|
|
p(stats);
|
2009-09-11 13:41:47 +02:00
|
|
|
success_count++;
|
2009-06-29 14:11:26 +02:00
|
|
|
});
|
|
|
|
|
|
|
|
promise.addErrback(function () {
|
|
|
|
got_error = true;
|
|
|
|
});
|
|
|
|
|
2009-09-11 13:41:47 +02:00
|
|
|
puts("stating: " + __filename);
|
2009-10-28 22:45:40 +01:00
|
|
|
posix.stat(__filename).addCallback(function (s) {
|
2009-09-11 13:41:47 +02:00
|
|
|
p(s);
|
|
|
|
success_count++;
|
|
|
|
|
|
|
|
puts("isDirectory: " + JSON.stringify( s.isDirectory() ) );
|
|
|
|
assertFalse(s.isDirectory());
|
|
|
|
|
|
|
|
puts("isFile: " + JSON.stringify( s.isFile() ) );
|
|
|
|
assertTrue(s.isFile());
|
|
|
|
|
|
|
|
puts("isSocket: " + JSON.stringify( s.isSocket() ) );
|
|
|
|
assertFalse(s.isSocket());
|
|
|
|
|
|
|
|
puts("isBlockDevice: " + JSON.stringify( s.isBlockDevice() ) );
|
|
|
|
assertFalse(s.isBlockDevice());
|
|
|
|
|
|
|
|
puts("isCharacterDevice: " + JSON.stringify( s.isCharacterDevice() ) );
|
|
|
|
assertFalse(s.isCharacterDevice());
|
|
|
|
|
|
|
|
puts("isFIFO: " + JSON.stringify( s.isFIFO() ) );
|
|
|
|
assertFalse(s.isFIFO());
|
|
|
|
|
|
|
|
puts("isSymbolicLink: " + JSON.stringify( s.isSymbolicLink() ) );
|
|
|
|
assertFalse(s.isSymbolicLink());
|
|
|
|
}).addErrback(function () {
|
|
|
|
got_error = true;
|
|
|
|
});
|
|
|
|
|
|
|
|
|
2009-08-26 18:51:04 +02:00
|
|
|
process.addListener("exit", function () {
|
2009-09-11 13:41:47 +02:00
|
|
|
assertEquals(2, success_count);
|
2009-06-29 14:11:26 +02:00
|
|
|
assertFalse(got_error);
|
|
|
|
assertTrue(stats.mtime instanceof Date);
|
2009-08-26 18:51:04 +02:00
|
|
|
});
|
2009-06-29 14:11:26 +02:00
|
|
|
|