Skip to content

Commit

Permalink
Add sharness tests for cat offset command
Browse files Browse the repository at this point in the history
License: MIT
Signed-off-by: ForrestWeston <forrest@protocol.ai>
  • Loading branch information
frrist committed Jan 2, 2018
1 parent 2b160d4 commit bc17543
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions test/sharness/t0040-add-and-cat.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
'

Expand Down

0 comments on commit bc17543

Please sign in to comment.