Skip to content

Commit ee3092f

Browse files
committedMay 23, 2015
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>
1 parent 0d1072a commit ee3092f

File tree

1 file changed

+38
-0
lines changed

1 file changed

+38
-0
lines changed
 

‎test/sharness/t0040-add-and-cat.sh

+38
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,44 @@ test_expect_success "'ipfs add -q' output looks good" '
8383
test_cmp expected actual
8484
'
8585

86+
test_expect_success "'ipfs add -q' with stdin input succeeds" '
87+
echo "Hello Jupiter!" | ipfs add -q >actual
88+
'
89+
90+
test_expect_success "'ipfs add -q' output looks good" '
91+
HASH="QmUnvPcBctVTAcJpigv6KMqDvmDewksPWrNVoy1E1WP5fh" &&
92+
echo "$HASH" >expected &&
93+
test_cmp expected actual
94+
'
95+
96+
test_expect_success "'ipfs cat' succeeds" '
97+
ipfs cat "$HASH" >actual
98+
'
99+
100+
test_expect_success "ipfs cat output looks good" '
101+
echo "Hello Jupiter!" >expected &&
102+
test_cmp expected actual
103+
'
104+
105+
test_expect_success "'ipfs add' with stdin input succeeds" '
106+
printf "Hello Neptune!\nHello Pluton!" | ipfs add >actual
107+
'
108+
109+
test_expect_success "'ipfs add' output looks good" '
110+
HASH="QmZDhWpi8NvKrekaYYhxKCdNVGWsFFe1CREnAjP1QbPaB3" &&
111+
echo "added $HASH " >expected &&
112+
test_cmp expected actual
113+
'
114+
115+
test_expect_success "'ipfs cat' with stdin input succeeds" '
116+
echo "$HASH" | ipfs cat >actual
117+
'
118+
119+
test_expect_success "ipfs cat with stdin input output looks good" '
120+
printf "Hello Neptune!\nHello Pluton!" >expected &&
121+
test_cmp expected actual
122+
'
123+
86124
test_expect_success "'ipfs add -r' succeeds" '
87125
mkdir mountdir/planets &&
88126
echo "Hello Mars!" >mountdir/planets/mars.txt &&

0 commit comments

Comments
 (0)
Please sign in to comment.