Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
dms3
go-dms3
Commits
76e8190a
Commit
76e8190a
authored
Sep 06, 2018
by
Kejie Zhang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
drop --name test file and update test case
License: MIT Signed-off-by:
Kejie Zhang
<
601172892@qq.com
>
parent
ad27614a
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
24 additions
and
79 deletions
+24
-79
cmd/ipfs/daemon.go
cmd/ipfs/daemon.go
+3
-3
test/sharness/t0040-add-and-cat.sh
test/sharness/t0040-add-and-cat.sh
+21
-0
test/sharness/t0047-add-name.sh
test/sharness/t0047-add-name.sh
+0
-76
No files found.
cmd/ipfs/daemon.go
View file @
76e8190a
test/sharness/t0040-add-and-cat.sh
View file @
76e8190a
...
...
@@ -184,6 +184,27 @@ test_add_cat_file() {
test_expect_success
"make sure it looks good"
'
test_cmp zero-length-file zero-length-file_out
'
test_expect_success
"ipfs add --name"
'
HASH="QmdFyxZXsFiP4csgfM5uPu99AvFiKH62CSPDw5TP92nr7w" &&
echo "IPFS" | ipfs add --name file.txt > actual &&
echo "added $HASH file.txt" > expected &&
test_cmp expected actual
'
test_expect_success
"ipfs add --name -w"
'
HASH1="QmdFyxZXsFiP4csgfM5uPu99AvFiKH62CSPDw5TP92nr7w" &&
echo "IPFS" | ipfs add -w --name file.txt | head -n1> actual &&
echo "added $HASH1 file.txt" > expected &&
test_cmp expected actual
'
test_expect_success
"ipfs cat with name"
'
HASH=$(echo "IPFS" | ipfs add -w --name file.txt -Q) &&
ipfs cat /ipfs/$HASH/file.txt > expected &&
echo "IPFS" > actual &&
test_cmp expected actual
'
}
test_add_cat_5MB
()
{
...
...
test/sharness/t0047-add-name.sh
deleted
100755 → 0
View file @
ad27614a
#!/usr/bin/env bash
#
# Copyright (c) 2018 Kejie Zhang
# MIT Licensed; see the LICENSE file in this repository.
#
test_description
=
"Test add --name"
add_name_m
=
'QmazHkwx6mPmmCEi1jR5YzjjQd1g5XzKfYQLzRAg7x5uUk'
add_name_1
=
'added Qme987pqNBhZZXy4ckeXiR7zaRQwBabB7fTgHurW2yJfNu 4r93'
add_name_2
=
'added Qme987pqNBhZZXy4ckeXiR7zaRQwBabB7fTgHurW2yJfNu 4r93
added Qmf82PSsMpUHcrqxa69KG6Qp5yeK7K9BTizXgG3nvzWcNG '
add_name_3
=
'added Qme987pqNBhZZXy4ckeXiR7zaRQwBabB7fTgHurW2yJfNu myfile.txt
added QmZbStPUUoRr1hA9GZyKx7pyskZvCczPrf6XSK6A9HSr1i '
add_name_4
=
'added Qme987pqNBhZZXy4ckeXiR7zaRQwBabB7fTgHurW2yJfNu myfile.txt'
.
lib/test-lib.sh
test_add_name
()
{
test_expect_success
"go-random-files is installed"
'
type random-files
'
test_expect_success
"random-files generates test files"
'
random-files --seed 7547632 --files 5 --dirs 2 --depth 3 m &&
echo "$add_name_m" >expected &&
ipfs add -q -r m | tail -n1 >actual &&
echo $actual
test_sort_cmp expected actual
'
# test --name without -w
test_expect_success
"ipfs add --name is correct"
'
echo "$add_name_1" >expected &&
ipfs add m/4r93 --name myfile.txt >actual
test_sort_cmp expected actual
'
# test --name with -w
test_expect_success
"ipfs add -w --name is correct"
'
echo "$add_name_2" >expected &&
ipfs add m/4r93 -w --name myfile.txt >actual
test_sort_cmp expected actual
'
# test --name with -w and cat
test_expect_success
"cat file | ipfs add -w --name is correct"
'
echo "$add_name_3" >expected &&
cat m/4r93 | ipfs add -w --name myfile.txt >actual
test_sort_cmp expected actual
'
# test --name with cat but without -w
test_expect_success
"cat file | ipfs add --name is correct"
'
echo "$add_name_4" >expected &&
cat m/4r93 | ipfs add --name myfile.txt >actual
test_sort_cmp expected actual
'
}
test_init_ipfs
test_add_name
test_launch_ipfs_daemon
test_add_name
test_kill_ipfs_daemon
test_done
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment