Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit ee57bcf

Browse files
committedJun 7, 2015
add some basic testing for object patch
1 parent 9a987b8 commit ee57bcf

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed
 

‎test/sharness/t0051-object.sh

+23
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,29 @@ test_object_cmd() {
9494
test_cmp expected_putBroken actual_putBroken &&
9595
test_cmp expected_putBrokenErr actual_putBrokenErr
9696
'
97+
98+
test_expect_success "'ipfs object patch' should work" '
99+
EMPTY_DIR=$(ipfs object new unixfs-dir) &&
100+
OUTPUT=$(ipfs object patch $EMPTY_DIR add-link foo $EMPTY_DIR)
101+
'
102+
103+
test_expect_success "should have created dir within a dir" '
104+
ipfs ls $OUTPUT > patched_output
105+
'
106+
107+
test_expect_success "output looks good" '
108+
echo "QmUNLLsPACCz1vLxQVkXqqLX5R1X345qqfHbsf67hvA3Nn 4 foo/ " > patched_exp &&
109+
test_cmp patched_exp patched_output
110+
'
111+
112+
test_expect_success "can remove the directory" '
113+
ipfs object patch $OUTPUT rm-link foo > rmlink_output
114+
'
115+
116+
test_expect_success "output should be empty" '
117+
echo QmUNLLsPACCz1vLxQVkXqqLX5R1X345qqfHbsf67hvA3Nn > rmlink_exp &&
118+
test_cmp rmlink_exp rmlink_output
119+
'
97120
}
98121

99122
# should work offline

0 commit comments

Comments
 (0)
Please sign in to comment.