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 | 05c0ba7f1e083767b3f405696a4428fddcd665a3 (patch) | |
tree | 64f7350eee25fa915e111b510a5dd94b3b147fea /eclass/tests | |
parent | add has/hasq stubs as some eclass use these in global scope (diff) | |
download | historical-05c0ba7f1e083767b3f405696a4428fddcd665a3.tar.gz historical-05c0ba7f1e083767b3f405696a4428fddcd665a3.tar.bz2 historical-05c0ba7f1e083767b3f405696a4428fddcd665a3.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}) |