From ee3092f8826fb8abfbe24d18c4613f6edfdaddca Mon Sep 17 00:00:00 2001 From: Christian Couder <chriscool@tuxfamily.org> Date: Sat, 23 May 2015 20:31:37 +0200 Subject: [PATCH] t0040: test ipfs add with stdin Let's test 'ipfs add' with stdin input too. License: MIT Signed-off-by: Christian Couder <chriscool@tuxfamily.org> --- test/sharness/t0040-add-and-cat.sh | 38 ++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/test/sharness/t0040-add-and-cat.sh b/test/sharness/t0040-add-and-cat.sh index a8a986439..03cdb75d4 100755 --- a/test/sharness/t0040-add-and-cat.sh +++ b/test/sharness/t0040-add-and-cat.sh @@ -83,6 +83,44 @@ test_expect_success "'ipfs add -q' output looks good" ' test_cmp expected actual ' +test_expect_success "'ipfs add -q' with stdin input succeeds" ' + echo "Hello Jupiter!" | ipfs add -q >actual +' + +test_expect_success "'ipfs add -q' output looks good" ' + HASH="QmUnvPcBctVTAcJpigv6KMqDvmDewksPWrNVoy1E1WP5fh" && + echo "$HASH" >expected && + test_cmp expected actual +' + +test_expect_success "'ipfs cat' succeeds" ' + ipfs cat "$HASH" >actual +' + +test_expect_success "ipfs cat output looks good" ' + echo "Hello Jupiter!" >expected && + test_cmp expected actual +' + +test_expect_success "'ipfs add' with stdin input succeeds" ' + printf "Hello Neptune!\nHello Pluton!" | ipfs add >actual +' + +test_expect_success "'ipfs add' output looks good" ' + HASH="QmZDhWpi8NvKrekaYYhxKCdNVGWsFFe1CREnAjP1QbPaB3" && + echo "added $HASH " >expected && + test_cmp expected actual +' + +test_expect_success "'ipfs cat' with stdin input succeeds" ' + echo "$HASH" | ipfs cat >actual +' + +test_expect_success "ipfs cat with stdin input output looks good" ' + printf "Hello Neptune!\nHello Pluton!" >expected && + test_cmp expected actual +' + test_expect_success "'ipfs add -r' succeeds" ' mkdir mountdir/planets && echo "Hello Mars!" >mountdir/planets/mars.txt && -- GitLab