From 1e384904b9e4955282536166cc92633d37afffbe Mon Sep 17 00:00:00 2001 From: Nulo Date: Sat, 24 Jun 2023 11:27:30 -0300 Subject: [PATCH] i-dont-know fixture --- test/extract.js | 20 ++++++++++++++++++++ test/fixtures/.gitattributes | 1 + test/fixtures/i-dont-know.tgz | 3 +++ test/fixtures/index.js | 1 + 4 files changed, 25 insertions(+) create mode 100644 test/fixtures/.gitattributes create mode 100644 test/fixtures/i-dont-know.tgz diff --git a/test/extract.js b/test/extract.js index 26d20e7..d92deec 100644 --- a/test/extract.js +++ b/test/extract.js @@ -676,6 +676,26 @@ test('gnu-incremental', function (t) { extract.end(fs.readFileSync(fixtures.GNU_INCREMENTAL_TAR)) }) +test('i-dont-know', function (t) { + t.plan(1) + const extract = tar.extract() + + extract.on('entry', function (header, stream, cb) { + console.debug(header.name) + stream.on('end', function () { + cb() // ready for next entry + }) + + stream.resume() + }) + + extract.on('finish', function () { + t.ok(true) + }) + + extract.end(fs.readFileSync(fixtures.I_DONT_KNOW)) +}) + test('v7 unsupported', function (t) { // correctly fails to parse v7 tarballs t.plan(1) diff --git a/test/fixtures/.gitattributes b/test/fixtures/.gitattributes new file mode 100644 index 0000000..7e6eb21 --- /dev/null +++ b/test/fixtures/.gitattributes @@ -0,0 +1 @@ +i-dont-know.tgz filter=lfs diff=lfs merge=lfs -text diff --git a/test/fixtures/i-dont-know.tgz b/test/fixtures/i-dont-know.tgz new file mode 100644 index 0000000..0a7b5b8 --- /dev/null +++ b/test/fixtures/i-dont-know.tgz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ee0e12490662b92bb2931d82f063b4e32c755cb17ceb12d36f2eb4d6bde67e73 +size 9605760 diff --git a/test/fixtures/index.js b/test/fixtures/index.js index 72ed85c..c393860 100644 --- a/test/fixtures/index.js +++ b/test/fixtures/index.js @@ -25,3 +25,4 @@ exports.GNU_INCREMENTAL_TAR = path.join(__dirname, 'gnu-incremental.tar') exports.UNKNOWN_FORMAT = path.join(__dirname, 'unknown-format.tar') // Created using gnu tar: tar cf v7.tar --format v7 test.txt exports.V7_TAR = path.join(__dirname, 'v7.tar') +exports.I_DONT_KNOW = path.join(__dirname, 'i-dont-know.tgz')