summaryrefslogtreecommitdiff
blob: 5260b268edb07efe417ab19ee2037afc1ea5423f (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
#!/bin/bash

source tests-common.sh

inherit eutils

tret=0

test-path_exists() {
	local exp=$1; shift
	ebegin "Testing path_exists($*) == ${exp}"
	path_exists "$@"
	[[ ${exp} -eq $? ]]
	eend $?
	: $(( tret |= $? ))
}

test-path_exists 1
test-path_exists 1 -a
test-path_exists 1 -o

good="/ . tests-common.sh /bin/bash"
test-path_exists 0 ${good}
test-path_exists 0 -a ${good}
test-path_exists 0 -o ${good}

bad="/asjdkfljasdlfkja jlakjdsflkasjdflkasdjflkasdjflaskdjf"
test-path_exists 1 ${bad}
test-path_exists 1 -a ${bad}
test-path_exists 1 -o ${bad}

test-path_exists 1 ${good} ${bad}
test-path_exists 1 -a ${good} ${bad}
test-path_exists 0 -o ${good} ${bad}

(exit ${tret})