From c214210354300538b5ae408003b16eea880cbe03 Mon Sep 17 00:00:00 2001 From: Jeromy <jeromyj@gmail.com> Date: Sat, 6 Jun 2015 17:31:59 -0700 Subject: [PATCH] add some basic testing for object patch --- test/sharness/t0051-object.sh | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/test/sharness/t0051-object.sh b/test/sharness/t0051-object.sh index c6433712b..9f909a5f7 100755 --- a/test/sharness/t0051-object.sh +++ b/test/sharness/t0051-object.sh @@ -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 -- GitLab