aboutsummaryrefslogtreecommitdiff
blob: 889aa95d80c416cd78bdbe431ac007aa738329c5 (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
#!/bin/bash

# TODO: Make these work with local vdb instead of requiring /.
if [[ -n ${TRAVIS_OS_NAME} ]] ; then
	echo "TODO: Make it work on non-Gentoo system"
	exit 0
fi

. ../init.sh || exit 1

tests=(
	"q file -Cq /bin/bash /bin/XXXXX"
	"app-shells/bash"

	"q file -Co /bin/bash /bin/XXXXX"
	"/bin/XXXXX"

	"printf \"/bin/bash\n/bin/XXXXX\" | q file -Cq -f -"
	"app-shells/bash"

	"printf \"/bin/bash\n/bin/XXXXX\" | q file -Co -f -"
	"/bin/XXXXX"

	"q file -Co -x bash /bin/bash"
	"/bin/bash"

	"q file -Co -x app-shells/bash /bin/bash"
	"/bin/bash"

	"q file -Co -x bash:0 /bin/bash"
	"/bin/bash"

	"q file -Co -x app-shells/bash:0 /bin/bash"
	"/bin/bash"

	"(cd /bin; q file -Cq bash)"
	"app-shells/bash"

	"(cd /; q file -Co bash)"
	"bash"
)

set -- "${tests[@]}"
while [[ $# -gt 0 ]] ; do
	test=$1; shift
	exp=$1; shift

	res=$(eval ${test})
	[[ "${res}" == "${exp}" ]]
	if ! tend $? "${test}" ; then
		(
		echo " - expected result was: ${exp}"
		echo " - actual result was:   ${res}"
		) > /dev/stderr
	fi
done

end