Add base 256 file size test (#67)

This commit is contained in:
Gil Pedersen 2017-05-11 15:09:44 +02:00 committed by Mathias Buus
parent 0eedd881d4
commit b4282a190c
3 changed files with 31 additions and 0 deletions

View file

@ -503,3 +503,33 @@ test('base 256 uid and gid', function (t) {
extract.end(fs.readFileSync(fixtures.BASE_256_UID_GID)) extract.end(fs.readFileSync(fixtures.BASE_256_UID_GID))
}) })
test('base 256 size', function (t) {
t.plan(2)
var extract = tar.extract()
extract.on('entry', function (header, stream, callback) {
t.deepEqual(header, {
name: 'test.txt',
mode: parseInt('644', 8),
uid: 501,
gid: 20,
size: 12,
mtime: new Date(1387580181000),
type: 'file',
linkname: null,
uname: 'maf',
gname: 'staff',
devmajor: 0,
devminor: 0
})
callback()
})
extract.on('finish', function () {
t.ok(true)
})
extract.end(fs.readFileSync(fixtures.BASE_256_SIZE))
})

BIN
test/fixtures/base-256-size.tar vendored Normal file

Binary file not shown.

View file

@ -13,3 +13,4 @@ exports.SPACE_TAR_GZ = path.join(__dirname, 'space.tar')
exports.GNU_LONG_PATH = path.join(__dirname, 'gnu-long-path.tar') exports.GNU_LONG_PATH = path.join(__dirname, 'gnu-long-path.tar')
exports.BASE_256_UID_GID = path.join(__dirname, 'base-256-uid-gid.tar') exports.BASE_256_UID_GID = path.join(__dirname, 'base-256-uid-gid.tar')
exports.LARGE_UID_GID = path.join(__dirname, 'large-uid-gid.tar') exports.LARGE_UID_GID = path.join(__dirname, 'large-uid-gid.tar')
exports.BASE_256_SIZE = path.join(__dirname, 'base-256-size.tar')