blob: 23c38dc9581a916e136146336dec901c96eec4ba (
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
|
#!/usr/bin/env roundup
describe librelib
. ./test-common.sh
before() {
_before
}
after() {
_after
}
it_displays_help_and_fails_with_0_args() {
ret=0
librelib >$tmpdir/stdout 2>$tmpdir/stderr || ret=$?
empty $tmpdir/stdout
[[ "$(sed 1q $tmpdir/stderr)" =~ Usage:.* ]]
[[ $ret != 0 ]]
}
it_fails_with_2_args() {
ret=0
librelib a b >$tmpdir/stdout 2>$tmpdir/stderr || ret=$?
empty $tmpdir/stdout
! empty $tmpdir/stderr
[[ $ret != 0 ]]
}
it_displays_usage_text() {
librelib -h >$tmpdir/stdout 2>$tmpdir/stderr
[[ "$(sed 1q $tmpdir/stdout)" =~ Usage:.* ]]
empty $tmpdir/stderr
}
# libremessages is executable
it_finds_messages() {
v1=$(librelib messages)
v2=$(librelib libremessages)
v3=$(librelib messages.sh)
v4=$(librelib libremessages.sh)
[[ -x "$v1" ]]
[[ "$v1" == "$v2" ]]
[[ "$v1" == "$v3" ]]
[[ "$v1" == "$v4" ]]
}
# conf.sh is non-executable
it_finds_conf() {
v1=$(librelib conf)
v2=$(librelib libreconf)
v3=$(librelib conf.sh)
v4=$(librelib libreconf.sh)
[[ -r "$v1" && ! -x "$v1" ]]
[[ "$v1" == "$v2" ]]
[[ "$v1" == "$v3" ]]
[[ "$v1" == "$v4" ]]
}
it_fails_to_find_phony() {
ret=0
librelib phony >$tmpdir/stdout 2>$tmpdir/stderr || ret=$?
empty $tmpdir/stdout
! empty $tmpdir/stderr
[[ $ret != 0 ]]
}
|