update `add --chunker` test
License: MIT Signed-off-by: Kejie Zhang <601172892@qq.com>
Kejie Zhang committed
Oct 8, 2018 at 14:15 UTC
f90ee061d38fa4ff1b560d0cc47a99751df1a960
1 file changed
+21
-2
test/sharness/t0040-add-and-cat.sh
+21
-2
@@ -156,15 +156,34 @@ test_add_cat_file() {
156
test_cmp expected actual
157
'
158
159
+ test_expect_success "ipfs add --chunker size-64 succeeds" '
160
+ ipfs add --chunker=size-64 mountdir/hello.txt >actual
161
+ '
162
+
163
+ test_expect_success "ipfs add --chunker size-64 output looks good" '
164
+ HASH="QmVr26fY1tKyspEJBniVhqxQeEjhF78XerGiqWAwraVLQH" &&
165
+ echo "added $HASH hello.txt" >expected &&
166
+ test_cmp expected actual
167
+ '
168
+
169
+ test_expect_success "ipfs add --chunker=size-0 failed" '
170
+ test_expect_code 1 ipfs add -Q --chunker=size-0 mountdir/hello.txt
171
+ '
172
+
173
test_expect_success "ipfs add --chunker rabin-36-512-1024 succeeds" '
160
- ipfs add -Q --chunker rabin-36-512-1024 mountdir/hello.txt
174
+ ipfs add --chunker rabin-36-512-1024 mountdir/hello.txt >actual
175
+ '
176
+
177
+ test_expect_success "ipfs add --chunker rabin-36-512-1024 output looks good" '
178
+ HASH="QmVr26fY1tKyspEJBniVhqxQeEjhF78XerGiqWAwraVLQH" &&
179
+ echo "added $HASH hello.txt" >expected &&
180
+ test_cmp expected actual
181
'
182
183
test_expect_success "ipfs add --chunker rabin-12-512-1024 failed" '
184
test_expect_code 1 ipfs add -Q --chunker rabin-12-512-1024 mountdir/hello.txt
185
'
186
167
-
187
test_expect_success "ipfs add on hidden file succeeds" '
188
echo "Hello Worlds!" >mountdir/.hello.txt &&
189
ipfs add mountdir/.hello.txt >actual