blob: 1ca2367bd9f1e42f92a8a92951caa0a6d59af121 (
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
|
#!/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 "(null) pkg (null)" "pkg"
test l02 "cat pkg (null)" "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 "(null)" -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 #638816
end
|