-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest.sh
More file actions
executable file
·52 lines (47 loc) · 808 Bytes
/
Copy pathtest.sh
File metadata and controls
executable file
·52 lines (47 loc) · 808 Bytes
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
# SPDX-License-Identifier: MIT
# Copyright (C) 2022 Da Xue
. traps.sh
TRAPS_DEBUG=1
function traps_test {
traps_start
traps_push "echo" "traps 1" "test 1" "drop"
traps_push "echo" "traps 2" "test 2" "pop"
traps_push "echo" "traps 3" "test 3" "drop"
traps_push "echo" "traps 2" "test 2" "pop"
traps_diag
echo
traps_isEmpty && echo "Empty" || echo "Not Empty"
echo
traps_drop
traps_diag
echo
traps_pop
traps_diag
echo
traps_drop
traps_diag
echo
traps_pop
traps_diag
echo
traps_stop
echo
traps_start
traps_cancel
echo
traps_pop && echo "FAILED" || true
traps_diag
echo
traps_cancel && echo "FAILED" || true
traps_diag
echo
set -eE
TRAPS_SIGNAL=ERR
traps_start
traps_push echo "test"
false
}
if [ "${BASH_SOURCE[0]##*/}" = "${0##*/}" ]; then
traps_test
fi