blob: c74f9d1dce05c547943cd4a54088cb27f1daf115 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
|
PATH=$(atf_get_srcdir)/..:$(atf_get_srcdir)/bin:$PATH
init_env() {
export ROOT=$PWD LIBDIR=$(atf_get_srcdir)/.. MOCK=echo
}
fake_bin() {
mkdir -p bin
cat > bin/"$1"
chmod +x bin/"$1"
PATH="$PWD/bin:$PATH"
}
init_tests() {
TESTS="$@"
export TESTS
for t; do
atf_test_case $t
done
}
atf_init_test_cases() {
for t in $TESTS; do
atf_add_test_case $t
done
}
test_usage() {
init_env
atf_check -s exit:0 \
-o match:"^usage: $@" \
-e empty \
$@ -h
atf_check -s exit:1 \
-o empty \
-e match:"^usage: $@" \
$@ -INVALID
}
|