Skip to content

Commit 8cacd9e

Browse files
committed
test/t0001-ocitools.t: Test --help and --version
Signed-off-by: W. Trevor King <[email protected]>
1 parent 259c6c5 commit 8cacd9e

File tree

3 files changed

+41
-0
lines changed

3 files changed

+41
-0
lines changed

test/README.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,20 @@ Run the tests with:
1717
And read the `Makefile` source to find other useful targets
1818
(e.g. [`prove`][prove]).
1919

20+
## Naming
21+
22+
0 - Global ocitools options.
23+
24+
## Dependencies
25+
26+
* [GNU Core Utilities][coreutils] for [`cat`][cat.1],
27+
[`echo`][echo.1], and [`head`][head.1].
28+
29+
[coreutils]: http://www.gnu.org/software/coreutils/coreutils.html
2030
[prove]: http://perldoc.perl.org/prove.html
2131
[Sharness]: http://mlafeldt.github.io/sharness/
2232
[submodule]: http://git-scm.com/docs/git-submodule
33+
34+
[cat.1]: http://pubs.opengroup.org/onlinepubs/9699919799/utilities/cat.html
35+
[echo.1]: http://pubs.opengroup.org/onlinepubs/9699919799/utilities/echo.html
36+
[head.1]: http://pubs.opengroup.org/onlinepubs/9699919799/utilities/head.html

test/sharness.d/posix-utilities.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
command -v cat >/dev/null 2>/dev/null && test_set_prereq CAT
2+
command -v echo >/dev/null 2>/dev/null && test_set_prereq ECHO
3+
command -v head >/dev/null 2>/dev/null && test_set_prereq HEAD
4+
5+
true

test/t0001-ocitools.t

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#!/bin/sh
2+
3+
test_description='Test ocitools global options'
4+
5+
. ./sharness.sh
6+
7+
test_expect_success CAT,HEAD 'Test ocitools --help' "
8+
ocitools --help | head -n2 >actual &&
9+
cat <<-EOF >expected &&
10+
NAME:
11+
oci - Utilities for OCI
12+
EOF
13+
test_cmp expected actual
14+
"
15+
16+
test_expect_success ECHO 'Test ocitools --version' "
17+
ocitools --version >actual &&
18+
echo 'oci version 0.0.1' >expected &&
19+
test_cmp expected actual
20+
"
21+
22+
test_done

0 commit comments

Comments
 (0)