]> pd.if.org Git - zpackage/blob - t/addfile.t
4b8e0932c0bce75b517b9de3f5db56e4c173b3e7
[zpackage] / t / addfile.t
1 #!/bin/sh
2
3 # test addfile
4
5 . tap.sh
6
7 plan 7
8
9 PF=test.db
10
11 rm -f $PF test.empty
12 touch test.empty
13
14 zpm init $PF
15 okexit create addfile test db
16
17 hash=$(zpm addfile $PF test.empty 2>> test.out)
18 okexit add empty file content
19 okstreq "$hash" e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 hash contents
20
21 appid=$(sqlite3 test.db 'pragma application_id')
22 okstreq $appid 1515209794 application id set
23
24 userv=$(sqlite3 test.db 'pragma user_version')
25 okstreq $userv 1 db version set
26
27 mkdir test.dir
28 zpm-addfile $PF test.dir 2>>test.out
29 failsok fail to add directory
30 rmdir test.dir
31
32 zpm-addfile $PF /dev/null 2>>test.out
33 failsok fail to device file
34
35 finish
36
37 rm -f $PF test.empty