blob: a0e6a34dc3ba316e4f89e064b749b37be620b80f (
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
|
#!/bin/bash
. ../init.sh || exit 1
test() {
local num=$1 exp=$2 ret=0 out
shift 2
set -- q atom "$@"
out=$("$@") || ret=$?
if [[ ${num} == l* ]] ; then
out=$(echo "${out}" | sed -r -e 's: +: :g' -e 's: *$::')
fi
if [[ ${out} != "${exp}" ]] ; then
tfail "output does not match: wanted '${exp}' but got '${out}'"
elif [[ ${ret} -ne 0 ]] ; then
tfail "exit code (${ret}) does not match expected (0)"
fi
tend $? "$*"
}
# Legacy format.
test l01 "<unset> pkg <unset>" "pkg"
test l02 "cat pkg <unset>" "cat/pkg"
test l03 "cat pkg 123" "cat/pkg-123"
test l04 "cat pkg 123 r4" "cat/pkg-123-r4"
test l05 "cat pkg 123 r4 :5" "cat/pkg-123-r4:5"
test l06 "cat pkg 123 :5" "cat/pkg-123:5"
test l07 "cat pkg 123 >=" ">=cat/pkg-123"
test l07 "cat pkg 123 = *" "=cat/pkg-123*"
# Explicit format.
test f01 "cat" -F '%{CATEGORY}' "cat/pkg"
test f02 "<unset>" -F '%{CATEGORY}' "pkg"
test f03 "" -F '%[CATEGORY]' "pkg"
test f04 "cat" -F '%{CATEGORY}' "cat/pkg-123-r4:5"
test f05 "pkg-123" -F '%{P}' "cat/pkg-123-r4:5"
test f06 "pkg" -F '%{PN}' "cat/pkg-123-r4:5"
test f07 "123" -F '%{PV}' "cat/pkg-123-r4:5"
test f08 "123-r4" -F '%{PVR}' "cat/pkg-123-r4:5"
test f09 "pkg-123-r4" -F '%{PF}' "cat/pkg-123-r4:5"
test f10 "r4" -F '%{PR}' "cat/pkg-123-r4:5"
test f11 ":5" -F '%{SLOT}' "cat/pkg-123-r4:5"
test f12 "pkg-c" -F '%{PN}' "cat/pkg-c" # bug #639978
test f13 "mod_perl 1.5_p20180304 r5" \
-F '%{PN} %{PV} %{PR}' \
"dev-libs/mod_perl-1.5_p20180304-r5"
test f14 "foo-r1" -F '%{PN}' "foo-r1" # bug #526596
test f15 "app-emacs diff-mode-" \
-F '%{CATEGORY} %{PN}' \
"app-emacs/diff-mode-"
end
|