blob: c1fecf3231333ac577e236c4abed2c37f43764a0 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
|
#!/bin/bash
# Copyright 1999-2015 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
source tests-common.sh
inherit eutils
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
|