t0080: improve last tests
License: MIT Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
Christian Couder committed
Dec 5, 2015 at 08:20 UTC
715e0c915e6eea8017f32f8f2dc25d84a924b776
1 file changed
+13
-9
test/sharness/t0080-repo.sh
+13
-9
@@ -197,11 +197,12 @@ test_expect_success "'ipfs refs --unique --recursive' is correct" '
197
echo "c1" > a/b/f1 &&
198
echo "c1" > a/b/c/f1 &&
199
echo "c2" > a/b/c/f2 &&
200
- ROOT=$(ipfs add -r -q a | tail -n1) &&
200
+ ipfs add -r -q a >add_output &&
201
+ ROOT=$(tail -n1 add_output) &&
202
ipfs refs --unique --recursive $ROOT >refs_output &&
203
wc -l refs_output | sed "s/^ *//g" >line_count &&
204
echo "4 refs_output" >expected &&
204
- test_cmp expected line_count
205
+ test_cmp expected line_count || test_fsh cat add_output || test_fsh cat refs_output
206
'
207
208
test_expect_success "'ipfs refs --recursive (bigger)'" '
@@ -215,16 +216,19 @@ test_expect_success "'ipfs refs --recursive (bigger)'" '
216
cp -r b b2 && mv b2 b/b2 &&
217
cp -r b b3 && mv b3 b/b3 &&
218
cp -r b b4 && mv b4 b/b4 &&
218
- hash=$(ipfs add -r -q b | tail -n1) &&
219
- ipfs refs -r "$hash" | wc -l | sed "s/^ *//g" >actual &&
220
- echo "79" >expected &&
221
- test_cmp expected actual
219
+ ipfs add -r -q b >add_output &&
220
+ hash=$(tail -n1 add_output) &&
221
+ ipfs refs -r "$hash" >refs_output &&
222
+ wc -l refs_output | sed "s/^ *//g" >actual &&
223
+ echo "79 refs_output" >expected &&
224
+ test_cmp expected actual || test_fsh cat add_output || test_fsh cat refs_output
225
'
226
227
test_expect_success "'ipfs refs --unique --recursive (bigger)'" '
225
- ipfs refs -r "$hash" | sort | uniq >expected &&
226
- ipfs refs -r -u "$hash" | sort >actual &&
227
- test_cmp expected actual
228
+ ipfs refs -r "$hash" >refs_output &&
229
+ sort refs_output | uniq >expected &&
230
+ ipfs refs -r -u "$hash" >actual &&
231
+ test_sort_cmp expected actual || test_fsh cat refs_output
232
'
233
234
test_kill_ipfs_daemon