trap16.0 revision 281718
1281718Sbdrewery# $FreeBSD: head/bin/sh/tests/builtins/trap16.0 281718 2015-04-18 23:49:57Z bdrewery $ 2281718Sbdrewery 3281718Sbdrewerytraps=$(${SH} -c 'trap "echo bad" 0; trap - 0; trap') 4281718Sbdrewery[ -z "$traps" ] || exit 1 5281718Sbdrewerytraps=$(${SH} -c 'trap "echo bad" 0; trap "" 0; trap') 6281718Sbdreweryexpected_traps=$(${SH} -c 'trap "" EXIT; trap') 7281718Sbdrewery[ "$traps" = "$expected_traps" ] || exit 2 8281718Sbdrewerytraps=$(${SH} -c 'trap "echo bad" 0; trap 0; trap') 9281718Sbdrewery[ -z "$traps" ] || exit 3 10281718Sbdrewerytraps=$(${SH} -c 'trap "echo bad" 0; trap -- 0; trap') 11281718Sbdrewery[ -z "$traps" ] || exit 4 12281718Sbdrewerytraps=$(${SH} -c 'trap "echo bad" 0 1 2; trap - 0 1 2; trap') 13281718Sbdrewery[ -z "$traps" ] || exit 5 14281718Sbdrewerytraps=$(${SH} -c 'trap "echo bad" 0 1 2; trap "" 0 1 2; trap') 15281718Sbdreweryexpected_traps=$(${SH} -c 'trap "" EXIT HUP INT; trap') 16281718Sbdrewery[ "$traps" = "$expected_traps" ] || exit 6 17281718Sbdrewerytraps=$(${SH} -c 'trap "echo bad" 0 1 2; trap 0 1 2; trap') 18281718Sbdrewery[ -z "$traps" ] || exit 7 19281718Sbdrewerytraps=$(${SH} -c 'trap "echo bad" 0 1 2; trap -- 0 1 2; trap') 20281718Sbdrewery[ -z "$traps" ] || exit 8 21