From b4282a190ceb6ac0ab5aa7e10dbd814df67db799 Mon Sep 17 00:00:00 2001 From: Gil Pedersen Date: Thu, 11 May 2017 15:09:44 +0200 Subject: [PATCH] Add base 256 file size test (#67) --- test/extract.js | 30 ++++++++++++++++++++++++++++++ test/fixtures/base-256-size.tar | Bin 0 -> 2048 bytes test/fixtures/index.js | 1 + 3 files changed, 31 insertions(+) create mode 100644 test/fixtures/base-256-size.tar diff --git a/test/extract.js b/test/extract.js index 6c95d37..9ac9765 100644 --- a/test/extract.js +++ b/test/extract.js @@ -503,3 +503,33 @@ test('base 256 uid and gid', function (t) { 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)) +}) diff --git a/test/fixtures/base-256-size.tar b/test/fixtures/base-256-size.tar new file mode 100644 index 0000000000000000000000000000000000000000..f6427736e533a2902873a4172030820c85f08b73 GIT binary patch literal 2048 zcmXR(EiTb3sVHHfAuup7Ff%bxU;xtQW~N};zzE21K-kG+Xk=t+YG`6=Vq~gdU}$J& zYz$O~kf$B1w74X(2