diff options
author | Mike Frysinger <vapier@gentoo.org> | 2010-10-17 21:37:03 +0000 |
---|---|---|
committer | Mike Frysinger <vapier@gentoo.org> | 2010-10-17 21:37:03 +0000 |
commit | e91f77dad9c3734c18b10ff3d3e12f62522dd310 (patch) | |
tree | 59d6dbeca2abc089aa859b9ecb2ba5478c43a365 /eclass/tests | |
parent | add has/hasq stubs as some eclass use these in global scope (diff) | |
download | gentoo-2-e91f77dad9c3734c18b10ff3d3e12f62522dd310.tar.gz gentoo-2-e91f77dad9c3734c18b10ff3d3e12f62522dd310.tar.bz2 gentoo-2-e91f77dad9c3734c18b10ff3d3e12f62522dd310.zip |
add tests for new path_exists func
Diffstat (limited to 'eclass/tests')
-rwxr-xr-x | eclass/tests/eutils:path_exists.sh | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/eclass/tests/eutils:path_exists.sh b/eclass/tests/eutils:path_exists.sh new file mode 100755 index 000000000000..5260b268edb0 --- /dev/null +++ b/eclass/tests/eutils:path_exists.sh @@ -0,0 +1,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}) |