Skip to content

Commit

Permalink
test/sharness/t0051-object.sh: Collect OUTPUT tests together
Browse files Browse the repository at this point in the history
Pull the independent multi-layer test added in d585e20 (allow patch
add-link to add at a path, 2015-06-19, #1404) out into a separate
block, so it's easier to read the single-layer tests that share the
OUTPUT variable.

License: MIT
Signed-off-by: W. Trevor King <wking@tremily.us>
  • Loading branch information
wking committed Jun 20, 2015
1 parent 3a1c8d7 commit 3f90ef4
Showing 1 changed file with 14 additions and 14 deletions.
28 changes: 14 additions & 14 deletions test/sharness/t0051-object.sh
Original file line number Diff line number Diff line change
Expand Up @@ -100,20 +100,6 @@ test_object_cmd() {
OUTPUT=$(ipfs object patch $EMPTY_DIR add-link foo $EMPTY_DIR)
'

test_expect_success "multilayer ipfs patch works" '
echo "hello world" > hwfile &&
FILE=$(ipfs add -q hwfile) &&
EMPTY=$(ipfs object new unixfs-dir) &&
ONE=$(ipfs object patch $EMPTY add-link b $EMPTY) &&
TWO=$(ipfs object patch $EMPTY add-link a $ONE) &&
ipfs object patch $TWO add-link a/b/c $FILE > multi_patch
'

test_expect_success "output looks good" '
ipfs cat $(cat multi_patch)/a/b/c > hwfile_out &&
test_cmp hwfile hwfile_out
'

test_expect_success "should have created dir within a dir" '
ipfs ls $OUTPUT > patched_output
'
Expand All @@ -131,6 +117,20 @@ test_object_cmd() {
echo QmUNLLsPACCz1vLxQVkXqqLX5R1X345qqfHbsf67hvA3Nn > rmlink_exp &&
test_cmp rmlink_exp rmlink_output
'

test_expect_success "multilayer ipfs patch works" '
echo "hello world" > hwfile &&
FILE=$(ipfs add -q hwfile) &&
EMPTY=$(ipfs object new unixfs-dir) &&
ONE=$(ipfs object patch $EMPTY add-link b $EMPTY) &&
TWO=$(ipfs object patch $EMPTY add-link a $ONE) &&
ipfs object patch $TWO add-link a/b/c $FILE > multi_patch
'

test_expect_success "output looks good" '
ipfs cat $(cat multi_patch)/a/b/c > hwfile_out &&
test_cmp hwfile hwfile_out
'
}

# should work offline
Expand Down

0 comments on commit 3f90ef4

Please sign in to comment.