From 2fcfbd8297fb9cb97597c9de25c7114ae102acf6 Mon Sep 17 00:00:00 2001 From: ForrestWeston Date: Tue, 2 Jan 2018 09:57:06 -0800 Subject: [PATCH] Add sharness tests for cat offset command License: MIT Signed-off-by: ForrestWeston --- test/sharness/t0040-add-and-cat.sh | 33 ++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/test/sharness/t0040-add-and-cat.sh b/test/sharness/t0040-add-and-cat.sh index a51247a8fb78..fc787eb5487c 100755 --- a/test/sharness/t0040-add-and-cat.sh +++ b/test/sharness/t0040-add-and-cat.sh @@ -46,11 +46,44 @@ test_add_cat_file() { test_cmp expected actual ' + test_expect_success "ipfs cat with offset succeeds" ' + ipfs cat --offset 10 "$HASH" >actual + ' + + test_expect_success "ipfs cat from offset output looks good" ' + echo "ds!" >expected && + test_cmp expected actual + ' + + test_expect_success "ipfs cat multiple hashes with offset succeeds" ' + ipfs cat --offset 10 "$HASH" "$HASH" >actual + ' + + test_expect_success "ipfs cat from offset output looks good" ' + echo "ds!" >expected && + echo "Hello Worlds!" >>expected && + test_cmp expected actual + ' + + test_expect_success "ipfs cat multiple hashes with offset succeeds" ' + ipfs cat --offset 16 "$HASH" "$HASH" >actual + ' + + test_expect_success "ipfs cat from offset output looks good" ' + echo "llo Worlds!" >expected && + test_cmp expected actual + ' + + test_expect_success "ipfs cat from negitive offset should fail" ' + test_expect_code 1 ipfs cat --offset -102 "$HASH" > actual + ' + test_expect_success "ipfs cat /ipfs/file succeeds" ' ipfs cat /ipfs/$HASH >actual ' test_expect_success "output looks good" ' + echo "Hello Worlds!" >expected && test_cmp expected actual '