Skip to content

Commit

Permalink
core/commands: pin ls: rewrites tests to avoid using --quiet
Browse files Browse the repository at this point in the history
  • Loading branch information
vitorbaptista committed Apr 27, 2015
1 parent 3a880d9 commit a356d0b
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions test/sharness/t0080-repo.sh
Original file line number Diff line number Diff line change
Expand Up @@ -102,10 +102,11 @@ test_expect_success "adding multiblock random file succeeds" '
MBLOCKHASH=`ipfs add -q multiblock`
'

test_expect_success "'ipfs pin ls --type=indirect --quiet' is correct" '
test_expect_success "'ipfs pin ls --type=indirect' is correct" '
ipfs refs "$MBLOCKHASH" >refsout &&
ipfs refs -r "$HASH_WELCOME_DOCS" >>refsout &&
ipfs pin ls --type=indirect --quiet >indirectpins &&
sed -i "s/\(.*\)/\1 indirect/g" refsout &&
ipfs pin ls --type=indirect >indirectpins &&
test_sort_cmp refsout indirectpins
'

Expand All @@ -121,28 +122,29 @@ test_expect_success "pin something directly" '
test_cmp expected10 actual10
'

test_expect_success "'ipfs pin ls --type=direct --quiet' is correct" '
echo "$DIRECTPIN" >directpinexpected &&
ipfs pin ls --type=direct --quiet >directpinout &&
test_expect_success "'ipfs pin ls --type=direct' is correct" '
echo "$DIRECTPIN direct" >directpinexpected &&
ipfs pin ls --type=direct >directpinout &&
test_sort_cmp directpinexpected directpinout
'

test_expect_success "'ipfs pin ls --type=recursive --quiet' is correct" '
test_expect_success "'ipfs pin ls --type=recursive' is correct" '
echo "$MBLOCKHASH" >rp_expected &&
echo "$HASH_WELCOME_DOCS" >>rp_expected &&
echo QmUNLLsPACCz1vLxQVkXqqLX5R1X345qqfHbsf67hvA3Nn >>rp_expected &&
ipfs refs -r "$HASH_WELCOME_DOCS" >>rp_expected &&
ipfs pin ls --type=recursive --quiet >rp_actual &&
sed -i "s/\(.*\)/\1 recursive/g" rp_expected &&
ipfs pin ls --type=recursive >rp_actual &&
test_sort_cmp rp_expected rp_actual
'

test_expect_success "'ipfs pin ls --type=all --quiet' is correct" '
cat directpinout >allpins &&
cat rp_actual >>allpins &&
cat indirectpins >>allpins &&
cat allpins | sort | uniq >> allpins_uniq &&
cut -f1 -d " " allpins | sort | uniq >> allpins_uniq_hashes &&
ipfs pin ls --type=all --quiet >actual_allpins &&
test_sort_cmp allpins_uniq actual_allpins
test_sort_cmp allpins_uniq_hashes actual_allpins
'

test_kill_ipfs_daemon
Expand Down

0 comments on commit a356d0b

Please sign in to comment.