summaryrefslogtreecommitdiff
path: root/eclass
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2011-12-17 06:09:46 +0000
committerMike Frysinger <vapier@gentoo.org>2011-12-17 06:09:46 +0000
commit9d48216a390870d0a037168f6c78e1d4ee72035e (patch)
treec9a7bb356435cd5b74f9bf4bfa63c6b9a0088456 /eclass
parentFixed #395029; removed "die" unneeded in EAPI 4 (diff)
downloadgentoo-2-9d48216a390870d0a037168f6c78e1d4ee72035e.tar.gz
gentoo-2-9d48216a390870d0a037168f6c78e1d4ee72035e.tar.bz2
gentoo-2-9d48216a390870d0a037168f6c78e1d4ee72035e.zip
extend eshopts test coverage
Diffstat (limited to 'eclass')
-rwxr-xr-xeclass/tests/eutils:eshopts.sh39
-rw-r--r--eclass/tests/tests-common.sh9
2 files changed, 43 insertions, 5 deletions
diff --git a/eclass/tests/eutils:eshopts.sh b/eclass/tests/eutils:eshopts.sh
index ff9b7d2a140f..65dc89c9f258 100755
--- a/eclass/tests/eutils:eshopts.sh
+++ b/eclass/tests/eutils:eshopts.sh
@@ -4,8 +4,41 @@ source tests-common.sh
inherit eutils
-# bug 395025
-eshopts_push -s nullglob
-eshopts_pop
+test-it() {
+ local s0 s1 s2
+
+ tbegin "push/pop '$*'"
+ s0=$(shopt -p)
+ t eshopts_push $*
+ s1=$(shopt -p)
+ t eshopts_pop
+ s2=$(shopt -p)
+ [[ ${s0} == "${s2}" ]] && \
+ [[ ${s1} == *"shopt $*"* ]]
+ tend $?
+}
+
+# should handle bug #395025
+for arg in nullglob dotglob extglob ; do
+ for flag in s u ; do
+ test-it -${flag} ${arg}
+ done
+done
+
+tbegin "multi push/pop"
+s0=$(shopt -p)
+t eshopts_push -s dotglob
+t eshopts_push -u dotglob
+t eshopts_push -s extglob
+t eshopts_push -u dotglob
+t eshopts_push -s dotglob
+t eshopts_pop
+t eshopts_pop
+t eshopts_pop
+t eshopts_pop
+t eshopts_pop
+s1=$(shopt -p)
+[[ ${s0} == "${s1}" ]]
+tend $?
texit
diff --git a/eclass/tests/tests-common.sh b/eclass/tests/tests-common.sh
index 3b1ffab5d764..c976e29aee56 100644
--- a/eclass/tests/tests-common.sh
+++ b/eclass/tests/tests-common.sh
@@ -96,6 +96,11 @@ texit() {
exit ${tret}
}
tend() {
- eend "$@"
- : $(( tret |= $? ))
+ t eend "$@"
+}
+t() {
+ "$@"
+ local ret=$?
+ : $(( tret |= ${ret} ))
+ return ${ret}
}