adding test for #11

This commit is contained in:
Mathias Buus 2014-03-24 15:25:36 +01:00
parent 37a497ff7e
commit 29189bf90d
3 changed files with 15 additions and 1 deletions

View file

@ -404,4 +404,17 @@ test('name-is-100', function(t) {
}); });
extract.end(fs.readFileSync(fixtures.NAME_IS_100_TAR)); extract.end(fs.readFileSync(fixtures.NAME_IS_100_TAR));
});
test('invalid-file', function(t) {
t.plan(1);
var extract = tar.extract();
extract.on('error', function(err) {
t.ok(!!err);
extract.destroy();
});
extract.end(fs.readFileSync(fixtures.INVALID_TGZ));
}); });

View file

@ -6,4 +6,5 @@ exports.TYPES_TAR = path.join(__dirname, 'types.tar');
exports.LONG_NAME_TAR = path.join(__dirname, 'long-name.tar'); exports.LONG_NAME_TAR = path.join(__dirname, 'long-name.tar');
exports.UNICODE_BSD_TAR = path.join(__dirname, 'unicode-bsd.tar'); exports.UNICODE_BSD_TAR = path.join(__dirname, 'unicode-bsd.tar');
exports.UNICODE_TAR = path.join(__dirname, 'unicode.tar'); exports.UNICODE_TAR = path.join(__dirname, 'unicode.tar');
exports.NAME_IS_100_TAR = path.join(__dirname, 'name-is-100.tar'); exports.NAME_IS_100_TAR = path.join(__dirname, 'name-is-100.tar');
exports.INVALID_TGZ = path.join(__dirname, 'invalid.tgz');

BIN
test/fixtures/invalid.tgz vendored Normal file

Binary file not shown.