提交 089496b9 作者: Steven Allen

test the ipfs cat --length flag

License: MIT
Signed-off-by: 's avatarSteven Allen <steven@stebalien.com>
上级 153bb681
...@@ -78,6 +78,56 @@ test_add_cat_file() { ...@@ -78,6 +78,56 @@ test_add_cat_file() {
test_expect_code 1 ipfs cat --offset -102 "$HASH" > actual test_expect_code 1 ipfs cat --offset -102 "$HASH" > actual
' '
test_expect_success "ipfs cat with length succeeds" '
ipfs cat --length 8 "$HASH" >actual
'
test_expect_success "ipfs cat with length output looks good" '
echo -n "Hello Wo" >expected &&
test_cmp expected actual
'
test_expect_success "ipfs cat multiple hashes with offset and length succeeds" '
ipfs cat --offset 5 --length 15 "$HASH" "$HASH" "$HASH" >actual
'
test_expect_success "ipfs cat multiple hashes with offset and length looks good" '
echo " Worlds!" >expected &&
echo -n "Hello " >>expected &&
test_cmp expected actual
'
test_expect_success "ipfs cat with exact length succeeds" '
ipfs cat --length $(ipfs cat "$HASH" | wc -c) "$HASH" >actual
'
test_expect_success "ipfs cat with exact length looks good" '
echo "Hello Worlds!" >expected &&
test_cmp expected actual
'
test_expect_success "ipfs cat with 0 length succeeds" '
ipfs cat --length 0 "$HASH" >actual
'
test_expect_success "ipfs cat with 0 length looks good" '
: >expected &&
test_cmp expected actual
'
test_expect_success "ipfs cat with oversized length succeeds" '
ipfs cat --length 100 "$HASH" >actual
'
test_expect_success "ipfs cat with oversized length looks good" '
echo "Hello Worlds!" >expected &&
test_cmp expected actual
'
test_expect_success "ipfs cat with negitive length should fail" '
test_expect_code 1 ipfs cat --length -102 "$HASH" > actual
'
test_expect_success "ipfs cat /ipfs/file succeeds" ' test_expect_success "ipfs cat /ipfs/file succeeds" '
ipfs cat /ipfs/$HASH >actual ipfs cat /ipfs/$HASH >actual
' '
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论