extend eshopts test coverage
authorMike Frysinger <vapier@gentoo.org>
Sat, 17 Dec 2011 06:09:46 +0000 (06:09 +0000)
committerMike Frysinger <vapier@gentoo.org>
Sat, 17 Dec 2011 06:09:46 +0000 (06:09 +0000)
eclass/tests/eutils:eshopts.sh
eclass/tests/tests-common.sh

index ff9b7d2a140fd5e3a1d6906f1cfe79d2189da5f2..65dc89c9f258a9a4b46bb69f4ff5a6c230a908f3 100755 (executable)
@@ -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
index 3b1ffab5d7649094e296c6ba7b7669b70cf090ba..c976e29aee56f3773e5a7b1b1c0205ae05fedfb2 100644 (file)
@@ -96,6 +96,11 @@ texit() {
        exit ${tret}
 }
 tend() {
-       eend "$@"
-       : $(( tret |= $? ))
+       t eend "$@"
+}
+t() {
+       "$@"
+       local ret=$?
+       : $(( tret |= ${ret} ))
+       return ${ret}
 }