]> pd.if.org Git - zpackage/blob - t/extract.t
treat - as stdout for zpm-extract
[zpackage] / t / extract.t
1 #!/bin/sh
2
3 # test addfile
4
5 . tap.sh
6
7 plan 5
8
9 PF=test.db
10
11 rm -f $PF test.foo
12 echo foo > test.foo
13
14 hash=$(zpm-addfile $PF test.foo 2>> test.out)
15 save=$?
16
17 okexit add foo file content
18 okstreq $hash b5bb9d8014a0f9b1d61e21e796d78dccdf1352f23cd32812f4850b878ae4944c foo hash contents
19
20 rm -f foo
21
22 zpm-extract $PF $hash test.foo2
23 okexit extract foo file content
24
25 sha=$(zpm-hash test.foo2)
26 okstreq $hash $sha extracted hash matches
27
28 sha=$(zpm-extract $PF $hash - | zpm-hash)
29 okstreq $hash $sha stdout extract hash matches
30
31 finish
32
33 rm -f test.*