add primaries to _test

This commit is contained in:
James Campos 2012-09-07 23:54:22 -07:00
parent 922f1d7639
commit faaffca2a7

View File

@ -530,8 +530,13 @@ function _test(options, path) {
// hack - only works with unary primaries
options = parseOptions(options, {
'b': 'block',
'c': 'character',
'd': 'directory',
'f': 'file'
'f': 'file',
'L': 'link',
'p': 'pipe',
'S': 'socket'
});
var canInterpret = false;
@ -549,11 +554,26 @@ function _test(options, path) {
stats = fs.lstatSync(path);
if (options.block)
return stats.isBlockDevice();
if (options.character)
return stats.isCharacterDevice();
if (options.directory)
return stats.isDirectory();
if (options.file)
return stats.isFile();
if (options.link)
return stats.isSymbolicLink();
if (options.pipe)
return stats.isFIFO();
if (options.socket)
return stats.isSocket()
}; // test
exports.test = wrap('test', _test);