From: Mike Frysinger Date: Sat, 17 Dec 2011 06:09:46 +0000 (+0000) Subject: extend eshopts test coverage X-Git-Url: http://git.tremily.us/gitweb.cgi?a=commitdiff_plain;h=90260dbcf4cc718418d84660e26122a2a02db64b;p=gentoo.git extend eshopts test coverage --- 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} }