summaryrefslogtreecommitdiff
path: root/eclass/tests/estack_estack.sh
diff options
context:
space:
mode:
authorV3n3RiX <venerix@redcorelinux.org>2017-10-09 18:53:29 +0100
committerV3n3RiX <venerix@redcorelinux.org>2017-10-09 18:53:29 +0100
commit4f2d7949f03e1c198bc888f2d05f421d35c57e21 (patch)
treeba5f07bf3f9d22d82e54a462313f5d244036c768 /eclass/tests/estack_estack.sh
reinit the tree, so we can have metadata
Diffstat (limited to 'eclass/tests/estack_estack.sh')
-rwxr-xr-xeclass/tests/estack_estack.sh52
1 files changed, 52 insertions, 0 deletions
diff --git a/eclass/tests/estack_estack.sh b/eclass/tests/estack_estack.sh
new file mode 100755
index 000000000000..4845243d3ae4
--- /dev/null
+++ b/eclass/tests/estack_estack.sh
@@ -0,0 +1,52 @@
+#!/bin/bash
+# Copyright 1999-2017 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+source tests-common.sh
+
+inherit estack
+
+tbegin "initial stack state"
+estack_pop teststack
+# Should be empty and thus return 1
+[[ $? -eq 1 ]]
+tend $?
+
+tbegin "simple push/pop"
+estack_push ttt 1
+pu=$?
+estack_pop ttt
+po=$?
+[[ ${pu}${po} == "00" ]]
+tend $?
+
+tbegin "simple push/pop var"
+estack_push xxx "boo ga boo"
+pu=$?
+estack_pop xxx i
+po=$?
+[[ ${pu}${po} == "00" ]] && [[ ${i} == "boo ga boo" ]]
+tend $?
+
+tbegin "multi push/pop"
+estack_push yyy {1..10}
+pu=$?
+i=0
+while estack_pop yyy ; do
+ : $(( i++ ))
+done
+[[ ${pu} -eq 0 && ${i} -eq 10 ]]
+tend $?
+
+tbegin "umask push/pop"
+u0=$(umask)
+eumask_push 0000
+pu=$?
+u1=$(umask)
+eumask_pop
+po=$?
+u2=$(umask)
+[[ ${pu}${po}:${u0}:${u1}:${u2} == "00:${u0}:0000:${u0}" ]]
+tend $?
+
+texit