From 9d48216a390870d0a037168f6c78e1d4ee72035e Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Sat, 17 Dec 2011 06:09:46 +0000 Subject: extend eshopts test coverage --- eclass/tests/eutils:eshopts.sh | 39 ++++++++++++++++++++++++++++++++++++--- eclass/tests/tests-common.sh | 9 +++++++-- 2 files changed, 43 insertions(+), 5 deletions(-) (limited to 'eclass') 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} } -- cgit v1.2.3-65-gdbad