Skip to content

Commit bcda5ee

Browse files
committed
test: trap_remove error on undefined function (closes #7)
The behavior specified in the linked issue already exists, so only a test was created for it
1 parent bb3b65e commit bcda5ee

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

tests/trap.bats

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,13 @@ load './util/init.sh'
3636
[ "${___global_trap_table___[USR1]}" = $'\x1Csomefunction\x1Csomefunction2' ]
3737
}
3838

39+
@test "core.trap_remove fails when function specified does not exist" {
40+
run core.trap_remove 'nonexistent' 'USR1'
41+
42+
assert_failure
43+
assert_output -p "Function 'nonexistent' is not defined"
44+
}
45+
3946
@test "core.trap_remove removes trap function properly 1" {
4047
somefunction() { :; }
4148
core.trap_add 'somefunction' 'USR1'

0 commit comments

Comments
 (0)