blob: 04b17cd283fd8ddf10c33ee87bdf0a36661b7d85 (
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
|
#!/usr/bin/env roundup
describe is_built
before() {
tmpdir=$(mktemp -d --tmpdir test-is_build.XXXXXXXXXXXX)
stat=0
}
after() {
rm -rf -- "$tmpdir"
}
it_displays_help() {
is_built -h >$tmpdir/stdout 2>$tmpdir/stderr
[[ "$(sed 1q $tmpdir/stdout)" =~ Usage:.* ]]
[[ -z "$(cat $tmpdir/stderr)" ]]
}
it_fails_with_0_args() {
is_built >$tmpdir/stdout 2>$tmpdir/stderr || stat=$?
[[ $stat -gt 1 ]]
[[ -z "$(cat $tmpdir/stdout)" ]]
[[ -n "$(cat $tmpdir/stderr)" ]]
}
it_succeeds_with_1_arg() {
is_built sh >$tmpdir/stdout 2>$tmpdir/stderr
[[ -z "$(cat $tmpdir/stdout)" ]]
[[ -z "$(cat $tmpdir/stderr)" ]]
}
it_returns_1_for_non_existent_package() {
is_built phony-ne-package 100 >$tmpdir/stdout 2>$tmpdir/stderr || stat=$?
[[ $stat == 1 ]]
[[ -z "$(cat $tmpdir/stdout)" ]]
[[ -z "$(cat $tmpdir/stderr)" ]]
}
it_returns_1_for_future_packages() {
# If emacs ever goes rapid release, we might need to change this :P
is_built emacs 100 >$tmpdir/stdout 2>$tmpdir/stderr || stat=$?
[[ $stat == 1 ]]
[[ -z "$(cat $tmpdir/stdout)" ]]
[[ -z "$(cat $tmpdir/stderr)" ]]
}
it_returns_0_for_past_packages() {
# If emacs ever goes rapid release, we might need to change this :P
is_built emacs 1 >$tmpdir/stdout 2>$tmpdir/stderr
[[ -z "$(cat $tmpdir/stdout)" ]]
[[ -z "$(cat $tmpdir/stderr)" ]]
}
|