2010-02-25 14:36:17 +08:00
|
|
|
process.mixin(require("../common"));
|
2009-09-04 03:29:20 +08:00
|
|
|
|
2010-02-26 08:32:30 +08:00
|
|
|
var got_error = false,
|
|
|
|
readdirDir = path.join(fixturesDir, "readdir")
|
2009-09-04 03:29:20 +08:00
|
|
|
|
2010-02-26 08:32:30 +08:00
|
|
|
var files = ['are'
|
|
|
|
, 'dir'
|
|
|
|
, 'empty'
|
|
|
|
, 'files'
|
|
|
|
, 'for'
|
|
|
|
, 'just'
|
|
|
|
, 'testing.js'
|
|
|
|
, 'these'
|
2010-02-22 15:02:36 +08:00
|
|
|
];
|
|
|
|
|
|
|
|
|
2010-02-26 08:32:30 +08:00
|
|
|
puts('readdirSync ' + readdirDir);
|
|
|
|
var f = fs.readdirSync(readdirDir);
|
2010-02-22 15:02:36 +08:00
|
|
|
p(f);
|
|
|
|
assert.deepEqual(files, f.sort());
|
|
|
|
|
|
|
|
|
2010-02-26 08:32:30 +08:00
|
|
|
puts("readdir " + readdirDir);
|
|
|
|
fs.readdir(readdirDir, function (err, f) {
|
2010-02-20 08:02:30 +08:00
|
|
|
if (err) {
|
|
|
|
puts("error");
|
|
|
|
got_error = true;
|
|
|
|
} else {
|
2010-02-22 15:02:36 +08:00
|
|
|
p(f);
|
|
|
|
assert.deepEqual(files, f.sort());
|
2010-02-20 08:02:30 +08:00
|
|
|
}
|
2009-09-04 03:29:20 +08:00
|
|
|
});
|
|
|
|
|
|
|
|
process.addListener("exit", function () {
|
2009-11-29 01:26:59 +08:00
|
|
|
assert.equal(false, got_error);
|
2009-09-04 03:29:20 +08:00
|
|
|
puts("exit");
|
|
|
|
});
|