2010-07-15 20:47:25 +02:00
|
|
|
common = require("../common");
|
|
|
|
assert = common.assert
|
2010-03-08 19:02:19 +01:00
|
|
|
var path = require('path');
|
|
|
|
var fs = require('fs');
|
2009-09-03 21:29:20 +02:00
|
|
|
|
2010-02-26 01:32:30 +01:00
|
|
|
var got_error = false,
|
2010-07-15 20:47:25 +02:00
|
|
|
readdirDir = path.join(common.fixturesDir, "readdir")
|
2009-09-03 21:29:20 +02:00
|
|
|
|
2010-02-26 01:32:30 +01:00
|
|
|
var files = ['are'
|
|
|
|
, 'dir'
|
|
|
|
, 'empty'
|
|
|
|
, 'files'
|
|
|
|
, 'for'
|
|
|
|
, 'just'
|
|
|
|
, 'testing.js'
|
|
|
|
, 'these'
|
2010-02-22 08:02:36 +01:00
|
|
|
];
|
|
|
|
|
|
|
|
|
2010-06-24 02:40:51 +02:00
|
|
|
console.log('readdirSync ' + readdirDir);
|
2010-02-26 01:32:30 +01:00
|
|
|
var f = fs.readdirSync(readdirDir);
|
2010-10-12 01:09:02 +02:00
|
|
|
console.dir(f);
|
2010-02-22 08:02:36 +01:00
|
|
|
assert.deepEqual(files, f.sort());
|
|
|
|
|
|
|
|
|
2010-06-24 02:40:51 +02:00
|
|
|
console.log("readdir " + readdirDir);
|
2010-02-26 01:32:30 +01:00
|
|
|
fs.readdir(readdirDir, function (err, f) {
|
2010-02-20 01:02:30 +01:00
|
|
|
if (err) {
|
2010-06-24 02:40:51 +02:00
|
|
|
console.log("error");
|
2010-02-20 01:02:30 +01:00
|
|
|
got_error = true;
|
|
|
|
} else {
|
2010-10-12 01:09:02 +02:00
|
|
|
console.dir(f);
|
2010-02-22 08:02:36 +01:00
|
|
|
assert.deepEqual(files, f.sort());
|
2010-02-20 01:02:30 +01:00
|
|
|
}
|
2009-09-03 21:29:20 +02:00
|
|
|
});
|
|
|
|
|
|
|
|
process.addListener("exit", function () {
|
2009-11-28 18:26:59 +01:00
|
|
|
assert.equal(false, got_error);
|
2010-06-24 02:40:51 +02:00
|
|
|
console.log("exit");
|
2009-09-03 21:29:20 +02:00
|
|
|
});
|