]> git.saurik.com Git - apple/shell_cmds.git/blob - sh/tests/builtins/trap16.0
shell_cmds-198.tar.gz
[apple/shell_cmds.git] / sh / tests / builtins / trap16.0
1 # $FreeBSD$
2
3 traps=$(${SH} -c 'trap "echo bad" 0; trap - 0; trap')
4 [ -z "$traps" ] || exit 1
5 traps=$(${SH} -c 'trap "echo bad" 0; trap "" 0; trap')
6 expected_traps=$(${SH} -c 'trap "" EXIT; trap')
7 [ "$traps" = "$expected_traps" ] || exit 2
8 traps=$(${SH} -c 'trap "echo bad" 0; trap 0; trap')
9 [ -z "$traps" ] || exit 3
10 traps=$(${SH} -c 'trap "echo bad" 0; trap -- 0; trap')
11 [ -z "$traps" ] || exit 4
12 traps=$(${SH} -c 'trap "echo bad" 0 1 2; trap - 0 1 2; trap')
13 [ -z "$traps" ] || exit 5
14 traps=$(${SH} -c 'trap "echo bad" 0 1 2; trap "" 0 1 2; trap')
15 expected_traps=$(${SH} -c 'trap "" EXIT HUP INT; trap')
16 [ "$traps" = "$expected_traps" ] || exit 6
17 traps=$(${SH} -c 'trap "echo bad" 0 1 2; trap 0 1 2; trap')
18 [ -z "$traps" ] || exit 7
19 traps=$(${SH} -c 'trap "echo bad" 0 1 2; trap -- 0 1 2; trap')
20 [ -z "$traps" ] || exit 8