t0080: use test_sort_cmp()
License: MIT Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
Christian Couder committed
Apr 4, 2015 at 07:37 UTC
c2e9a080985cd7eb5ca1cab9611f6cf925e93b46
1 file changed
+6
-18
test/sharness/t0080-repo.sh
+6
-18
@@ -49,10 +49,8 @@ test_expect_success "file no longer pinned" '
49
echo "$HASH_WELCOME_DOCS" >expected2 &&
50
ipfs refs -r "$HASH_WELCOME_DOCS" >>expected2 &&
51
echo QmUNLLsPACCz1vLxQVkXqqLX5R1X345qqfHbsf67hvA3Nn >> expected2 &&
52
- sort expected2 >expected_sorted2 &&
52
ipfs pin ls -type=recursive >actual2 &&
54
- sort actual2 >actual_sorted2 &&
55
- test_cmp expected_sorted2 actual_sorted2
53
+ test_sort_cmp expected2 actual2
54
'
55
56
test_expect_success "recursively pin afile" '
@@ -95,10 +93,8 @@ test_expect_failure "'ipfs refs local' no longer shows file" '
93
echo QmUNLLsPACCz1vLxQVkXqqLX5R1X345qqfHbsf67hvA3Nn >expected8 &&
94
echo "$HASH_WELCOME_DOCS" >>expected8 &&
95
ipfs refs -r "$HASH_WELCOME_DOCS" >>expected8 &&
98
- sort expected8 >expected_sorted8 &&
96
ipfs refs local >actual8 &&
100
- sort actual8 >actual_sorted8 &&
101
- test_cmp expected_sorted8 actual_sorted8
97
+ test_sort_cmp expected8 actual8
98
'
99
100
test_expect_success "adding multiblock random file succeeds" '
@@ -109,10 +105,8 @@ test_expect_success "adding multiblock random file succeeds" '
105
test_expect_success "'ipfs pin ls -type=indirect' is correct" '
106
ipfs refs "$MBLOCKHASH" >refsout &&
107
ipfs refs -r "$HASH_WELCOME_DOCS" >>refsout &&
112
- sort refsout >refsout_sorted &&
108
ipfs pin ls -type=indirect >indirectpins &&
114
- sort indirectpins >indirectpins_sorted &&
115
- test_cmp refsout_sorted indirectpins_sorted
109
+ test_sort_cmp refsout indirectpins
110
'
111
112
test_expect_success "pin something directly" '
@@ -129,10 +123,8 @@ test_expect_success "pin something directly" '
123
124
test_expect_success "'ipfs pin ls -type=direct' is correct" '
125
echo "$DIRECTPIN" >directpinexpected &&
132
- sort directpinexpected >dp_exp_sorted &&
126
ipfs pin ls -type=direct >directpinout &&
134
- sort directpinout >dp_out_sorted &&
135
- test_cmp dp_exp_sorted dp_out_sorted
127
+ test_sort_cmp directpinexpected directpinout
128
'
129
130
test_expect_success "'ipfs pin ls -type=recursive' is correct" '
@@ -140,20 +132,16 @@ test_expect_success "'ipfs pin ls -type=recursive' is correct" '
132
echo "$HASH_WELCOME_DOCS" >>rp_expected &&
133
echo QmUNLLsPACCz1vLxQVkXqqLX5R1X345qqfHbsf67hvA3Nn >>rp_expected &&
134
ipfs refs -r "$HASH_WELCOME_DOCS" >>rp_expected &&
143
- sort rp_expected >rp_exp_sorted &&
135
ipfs pin ls -type=recursive >rp_actual &&
145
- sort rp_actual >rp_act_sorted &&
146
- test_cmp rp_exp_sorted rp_act_sorted
136
+ test_sort_cmp rp_expected rp_actual
137
'
138
139
test_expect_success "'ipfs pin ls -type=all' is correct" '
140
cat directpinout >allpins &&
141
cat rp_actual >>allpins &&
142
cat indirectpins >>allpins &&
153
- sort allpins >allpins_sorted &&
143
ipfs pin ls -type=all >actual_allpins &&
155
- sort actual_allpins >actual_allpins_sorted &&
156
- test_cmp allpins_sorted actual_allpins_sorted
144
+ test_sort_cmp allpins actual_allpins
145
'
146
147
test_kill_ipfs_daemon