@cryptotaxi247 / kubo / commits / 893ab6dc8

t0081: use 'ipfs pin ls <arg>' in test_pin_flagi()

License: MIT Signed-off-by: Christian Couder <chriscool@tuxfamily.org>

Christian Couder committed Jan 16, 2016 at 13:12 UTC 893ab6dc8333719027f2704712d6886f11aecb22
1 file changed +9 -16
test/sharness/t0081-repo-pinning.sh
+9 -16
@@ -8,30 +8,23 @@ test_description="Test ipfs repo pinning"
8
9 . lib/test-lib.sh
10
11 -
12 -
11 test_pin_flag() {
12 object=$1
13 ptype=$2
14 expect=$3
15
18 - echo "test_pin_flag" $@
16 + echo "test_pin_flag" "$@"
17
20 - ipfs-pin-stat "$object" | egrep "\b$ptype\b"
21 - actual=$?
22 -
23 - if [ "$expect" = "true" ]; then
24 - if [ "$actual" != "0" ]; then
25 - echo "$object should be pinned $ptype ($actual)"
26 - return 1
27 - fi
18 + if ipfs pin ls --type="$ptype" "$object" >actual
19 + then
20 + test "$expect" = "true" && return
21 + test_fsh cat actual
22 + return
23 else
29 - if [ "$actual" != "1" ]; then
30 - echo "$object should NOT be pinned $ptype ($actual)"
31 - return 1
32 - fi
24 + test "$expect" = "false" && return
25 + test_fsh cat actual
26 + return
27 fi
34 - return 0
28 }
29
30 test_pin() {