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>
Christian Couder committed
May 23, 2015 at 20:31 UTC
ee3092f8826fb8abfbe24d18c4613f6edfdaddca
1 file changed
+38
test/sharness/t0040-add-and-cat.sh
+38
@@ -83,6 +83,44 @@ test_expect_success "'ipfs add -q' output looks good" '
83
test_cmp expected actual
84
'
85
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
+
124
test_expect_success "'ipfs add -r' succeeds" '
125
mkdir mountdir/planets &&
126
echo "Hello Mars!" >mountdir/planets/mars.txt &&