11# full DAG export, everything in the CAR
22mkdir actual-full
3- car extract -f ${INPUTS}/simple-unixfs.car actual-full
3+ car extract -f ${INPUTS}/simple-unixfs.car -o actual-full
44stderr '^extracted 9 file\(s\)$'
55cmp actual-full/a/1/A.txt expected/a/1/A.txt
66cmp actual-full/a/2/B.txt expected/a/2/B.txt
@@ -15,7 +15,7 @@ cmp actual-full/c/8/H.txt expected/c/8/H.txt
1515# full DAG export, everything in the CAR, accepted from stdin
1616mkdir actual-stdin
1717stdin ${INPUTS}/simple-unixfs.car
18- car extract actual-stdin
18+ car extract -f - -o actual-stdin
1919stderr '^extracted 9 file\(s\)$'
2020cmp actual-stdin/a/1/A.txt expected/a/1/A.txt
2121cmp actual-stdin/a/2/B.txt expected/a/2/B.txt
@@ -29,7 +29,7 @@ cmp actual-stdin/c/8/H.txt expected/c/8/H.txt
2929
3030# full DAG export, everything in the CAR, but the CAR is missing blocks (incomplete DAG)
3131mkdir actual-missing
32- car extract -f ${INPUTS}/simple-unixfs-missing-blocks.car actual-missing
32+ car extract -f ${INPUTS}/simple-unixfs-missing-blocks.car -o actual-missing
3333stderr -count=1 'data for entry not found: /b/4 \(skipping\.\.\.\)'
3434stderr -count=1 'data for entry not found: /b/5/E.txt \(skipping\.\.\.\)'
3535stderr -count=1 'data for entry not found: /b/6 \(skipping\.\.\.\)'
@@ -46,7 +46,7 @@ cmp actual-missing/c/8/H.txt expected/c/8/H.txt
4646
4747# path-based partial export, everything under the path specified (also without leading / in path)
4848mkdir actual-partial
49- car extract -f ${INPUTS}/simple-unixfs.car -p b actual-partial
49+ car extract -f ${INPUTS}/simple-unixfs.car -o actual-partial b
5050stderr '^extracted 3 file\(s\)$'
5151! exists actual-partial/a/1/A.txt
5252! exists actual-partial/a/2/B.txt
@@ -60,7 +60,7 @@ cmp actual-partial/b/4/D.txt expected/b/4/D.txt
6060
6161# path-based single-file export (also with leading /)
6262mkdir actual-single
63- car extract -f ${INPUTS}/simple-unixfs.car -p /a/2/B.txt actual-single
63+ car extract -f ${INPUTS}/simple-unixfs.car -o actual-single /a/2/B.txt
6464stderr '^extracted 1 file\(s\)$'
6565! exists actual-single/a/1/A.txt
6666cmp actual-single/a/2/B.txt expected/a/2/B.txt
@@ -72,18 +72,32 @@ cmp actual-single/a/2/B.txt expected/a/2/B.txt
7272! exists actual-single/c/7/G.txt
7373! exists actual-single/c/8/H.txt
7474
75+ # path-based multiple export
76+ mkdir actual-multiple
77+ car extract -f ${INPUTS}/simple-unixfs.car -o actual-multiple /a b/6 /c/7/G.txt
78+ stderr '^extracted 5 file\(s\)$'
79+ cmp actual-multiple/a/1/A.txt expected/a/1/A.txt
80+ cmp actual-multiple/a/2/B.txt expected/a/2/B.txt
81+ cmp actual-multiple/a/3/C.txt expected/a/3/C.txt
82+ ! exists actual-multiple/b/5/E.txt
83+ cmp actual-multiple/b/6/F.txt expected/b/6/F.txt
84+ ! exists actual-multiple/b/4/D.txt
85+ ! exists actual-multiple/c/9/I.txt
86+ cmp actual-multiple/c/7/G.txt expected/c/7/G.txt
87+ ! exists actual-multiple/c/8/H.txt
88+
7589# extract that doesn't yield any files should error
76- ! car extract -f ${INPUTS}/simple-unixfs-missing-blocks.car -p b
90+ ! car extract -f ${INPUTS}/simple-unixfs-missing-blocks.car b
7791stderr '^no files extracted$'
7892
7993# car with only one file, nested inside sharded directory, output to stdout
80- car extract -f ${INPUTS}/wikipedia-cryptographic-hash-function.car -p wiki/Cryptographic_hash_function -
94+ car extract -f ${INPUTS}/wikipedia-cryptographic-hash-function.car -o - wiki/Cryptographic_hash_function
8195stderr '^extracted 1 file\(s\)$'
8296stdout -count=1 '^ <title>Cryptographic hash function</title>$'
8397
8498# car with only one file, full extract, lots of errors
8599mkdir actual-wiki
86- car extract -f ${INPUTS}/wikipedia-cryptographic-hash-function.car actual-wiki
100+ car extract -f ${INPUTS}/wikipedia-cryptographic-hash-function.car -o actual-wiki
87101stderr '^extracted 1 file\(s\)$'
88102stderr -count=1 '^data for entry not found for 570 unknown sharded entries \(skipped\.\.\.\)$'
89103# random sampling of expected skip errors
110124-- expected/c/7/G.txt --
111125c7G
112126-- expected/c/8/H.txt --
113- c8H
127+ c8H
0 commit comments