Skip to content
This repository was archived by the owner on Feb 12, 2024. It is now read-only.

Commit 5d5d360

Browse files
committed
sharness: add t0010-basic-commands.sh
1 parent 1b6fca8 commit 5d5d360

File tree

1 file changed

+75
-0
lines changed

1 file changed

+75
-0
lines changed

test/sharness/t0010-basic-commands.sh

+75
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
#!/bin/sh
2+
#
3+
# Copyright (c) 2014 Christian Couder
4+
# MIT Licensed; see the LICENSE file in this repository.
5+
#
6+
7+
test_description="Test installation and some basic commands"
8+
9+
. lib/test-lib.sh
10+
11+
test_expect_success "current dir is writable" '
12+
echo "It works!" >test.txt
13+
'
14+
15+
test_expect_success "ipfs version succeeds" '
16+
ipfs version >version.txt
17+
'
18+
19+
test_expect_success "ipfs version shows js-ipfs" '
20+
grep "js-ipfs" version.txt >/dev/null ||
21+
test_fsh cat version.txt
22+
'
23+
24+
test_expect_success "ipfs version output looks good" '
25+
egrep "^js-ipfs version: [0-9]+\.[0-9]+\.[0-9]" version.txt >/dev/null ||
26+
test_fsh cat version.txt
27+
'
28+
29+
test_expect_success "ipfs version --all has all required fields" '
30+
ipfs version --all > version_all.txt &&
31+
grep "go-ipfs version" version_all.txt &&
32+
grep "Repo version" version_all.txt &&
33+
grep "System version" version_all.txt &&
34+
grep "Golang version" version_all.txt
35+
'
36+
37+
test_expect_success "ipfs help succeeds" '
38+
ipfs help >help.txt
39+
'
40+
41+
test_expect_success "ipfs help output looks good" '
42+
egrep -i "^Usage" help.txt >/dev/null &&
43+
egrep "ipfs .* <command>" help.txt >/dev/null ||
44+
test_fsh cat help.txt
45+
'
46+
47+
test_expect_success "'ipfs commands' succeeds" '
48+
ipfs commands >commands.txt
49+
'
50+
51+
test_expect_success "'ipfs commands' output looks good" '
52+
grep "ipfs add" commands.txt &&
53+
grep "ipfs daemon" commands.txt &&
54+
grep "ipfs update" commands.txt
55+
'
56+
57+
test_expect_success "All commands accept --help" '
58+
while read -r cmd
59+
do
60+
echo "running: $cmd --help"
61+
$cmd --help </dev/null >/dev/null || return
62+
done <commands.txt
63+
'
64+
65+
test_expect_success "'ipfs commands --flags' succeeds" '
66+
ipfs commands --flags >commands.txt
67+
'
68+
69+
test_expect_success "'ipfs commands --flags' output looks good" '
70+
grep "ipfs pin add --recursive / ipfs pin add -r" commands.txt &&
71+
grep "ipfs id --format / ipfs id -f" commands.txt &&
72+
grep "ipfs repo gc --quiet / ipfs repo gc -q" commands.txt
73+
'
74+
75+
test_done

0 commit comments

Comments
 (0)