#!/bin/sh
-# test addfile
-
. tap.sh
-plan 4
+plan 6
PF=test.db
rm -f $PF test.foo
echo foo > test.foo
+zpm init test.db
+okexit create extract test db
+
hash=$(zpm-addfile $PF test.foo 2>> test.out)
save=$?
okexit add foo file content
-okstreq $hash b5bb9d8014a0f9b1d61e21e796d78dccdf1352f23cd32812f4850b878ae4944c foo hash contents
+okstreq "$hash" b5bb9d8014a0f9b1d61e21e796d78dccdf1352f23cd32812f4850b878ae4944c foo hash contents
rm -f foo
sha=$(zpm-hash test.foo2)
okstreq $hash $sha extracted hash matches
+sha=$(zpm-extract $PF $hash - | zpm-hash)
+okstreq $hash $sha stdout extract hash matches
+
finish
rm -f test.*