Skip to content

Commit

Permalink
add some basic testing for object patch
Browse files Browse the repository at this point in the history
  • Loading branch information
whyrusleeping committed Jun 7, 2015
1 parent 9a987b8 commit ee57bcf
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions test/sharness/t0051-object.sh
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,29 @@ test_object_cmd() {
test_cmp expected_putBroken actual_putBroken &&
test_cmp expected_putBrokenErr actual_putBrokenErr
'

test_expect_success "'ipfs object patch' should work" '
EMPTY_DIR=$(ipfs object new unixfs-dir) &&
OUTPUT=$(ipfs object patch $EMPTY_DIR add-link foo $EMPTY_DIR)
'

test_expect_success "should have created dir within a dir" '
ipfs ls $OUTPUT > patched_output
'

test_expect_success "output looks good" '
echo "QmUNLLsPACCz1vLxQVkXqqLX5R1X345qqfHbsf67hvA3Nn 4 foo/ " > patched_exp &&
test_cmp patched_exp patched_output
'

test_expect_success "can remove the directory" '
ipfs object patch $OUTPUT rm-link foo > rmlink_output
'

test_expect_success "output should be empty" '
echo QmUNLLsPACCz1vLxQVkXqqLX5R1X345qqfHbsf67hvA3Nn > rmlink_exp &&
test_cmp rmlink_exp rmlink_output
'
}

# should work offline
Expand Down

0 comments on commit ee57bcf

Please sign in to comment.