test(add): add test for issue \#5456
License: MIT Signed-off-by: Overbool <overbool.xu@gmail.com>
Overbool committed
Sep 20, 2018 at 07:54 UTC
d656ade8237a9bbc802fb9e7ee6aa509067adab4
1 file changed
+30
test/sharness/t0040-add-and-cat.sh
+30
@@ -214,6 +214,36 @@ test_add_cat_file() {
214
echo "IPFS" > actual &&
215
test_cmp expected actual
216
'
217
+
218
+ test_expect_success "ipfs add -r ." '
219
+ mkdir test_current_dir &&
220
+ echo "Hey" > test_current_dir/hey &&
221
+ mkdir test_current_dir/hello &&
222
+ echo "World" > test_current_dir/hello/world &&
223
+ ( cd test_current_dir &&
224
+ ipfs add -r . | tail -n1 > ../actual && cd ../ ) &&
225
+ rm -r test_current_dir
226
+ '
227
+
228
+ test_expect_success "ipfs add -r . output looks good" '
229
+ echo "added QmZQWnfcqJ6hNkkPvrY9Q5X39GP3jUnUbAV4AbmbbR3Cb1 test_current_dir" > expected
230
+ test_cmp expected actual
231
+ '
232
+
233
+ test_expect_success "ipfs add -r ./" '
234
+ mkdir test_current_dir &&
235
+ echo "Hey" > test_current_dir/hey &&
236
+ mkdir test_current_dir/hello &&
237
+ echo "World" > test_current_dir/hello/world &&
238
+ ( cd test_current_dir &&
239
+ ipfs add -r ./ | tail -n1 > ../actual && cd ../ ) &&
240
+ rm -r test_current_dir
241
+ '
242
+
243
+ test_expect_success "ipfs add -r ./ output looks good" '
244
+ echo "added QmZQWnfcqJ6hNkkPvrY9Q5X39GP3jUnUbAV4AbmbbR3Cb1 test_current_dir" > expected
245
+ test_cmp expected actual
246
+ '
247
}
248
249
test_add_cat_5MB() {