Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

t0080 improvements #2041

Merged
merged 2 commits into from
Dec 12, 2015
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 16 additions & 11 deletions test/sharness/t0080-repo.sh
Original file line number Diff line number Diff line change
Expand Up @@ -185,10 +185,11 @@ test_expect_success "'ipfs refs --unique' is correct" '
cd uniques &&
echo "content1" > file1 &&
echo "content1" > file2 &&
ROOT=$(ipfs add -r -q . | tail -n1) &&
ipfs add -r -q . > ../add_output &&
ROOT=$(tail -n1 ../add_output) &&
ipfs refs --unique $ROOT >expected &&
ipfs add -q file1 >unique_hash &&
test_cmp expected unique_hash
test_cmp expected unique_hash || test_fsh cat ../add_output
'

test_expect_success "'ipfs refs --unique --recursive' is correct" '
Expand All @@ -197,11 +198,12 @@ test_expect_success "'ipfs refs --unique --recursive' is correct" '
echo "c1" > a/b/f1 &&
echo "c1" > a/b/c/f1 &&
echo "c2" > a/b/c/f2 &&
ROOT=$(ipfs add -r -q a | tail -n1) &&
ipfs add -r -q a >add_output &&
ROOT=$(tail -n1 add_output) &&
ipfs refs --unique --recursive $ROOT >refs_output &&
wc -l refs_output | sed "s/^ *//g" >line_count &&
echo "4 refs_output" >expected &&
test_cmp expected line_count
test_cmp expected line_count || test_fsh cat add_output || test_fsh cat refs_output
'

test_expect_success "'ipfs refs --recursive (bigger)'" '
Expand All @@ -215,16 +217,19 @@ test_expect_success "'ipfs refs --recursive (bigger)'" '
cp -r b b2 && mv b2 b/b2 &&
cp -r b b3 && mv b3 b/b3 &&
cp -r b b4 && mv b4 b/b4 &&
hash=$(ipfs add -r -q b | tail -n1) &&
ipfs refs -r "$hash" | wc -l | sed "s/^ *//g" >actual &&
echo "79" >expected &&
test_cmp expected actual
ipfs add -r -q b >add_output &&
hash=$(tail -n1 add_output) &&
ipfs refs -r "$hash" >refs_output &&
wc -l refs_output | sed "s/^ *//g" >actual &&
echo "79 refs_output" >expected &&
test_cmp expected actual || test_fsh cat add_output || test_fsh cat refs_output
'

test_expect_success "'ipfs refs --unique --recursive (bigger)'" '
ipfs refs -r "$hash" | sort | uniq >expected &&
ipfs refs -r -u "$hash" | sort >actual &&
test_cmp expected actual
ipfs refs -r "$hash" >refs_output &&
sort refs_output | uniq >expected &&
ipfs refs -r -u "$hash" >actual &&
test_sort_cmp expected actual || test_fsh cat refs_output
'

test_kill_ipfs_daemon
Expand Down