You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: tests/trap.bats
+67-2Lines changed: 67 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -9,6 +9,27 @@ load './util/init.sh'
9
9
# The '${___global_trap_table___[nokey]}' is there to ensure that the
10
10
# ___global_trap_table___ is an actual associative array. If '___global_trap_table___' is not an associative array, the index with 'nokey' still returns the value of the variable (no error will be thrown). These were origianlly done when the 'core.init' function was not called within these tests
11
11
12
+
@test "core.trap_add fails when function is not supplied" {
13
+
run core.trap_add '''USR1'
14
+
15
+
assert_failure
16
+
assert_output -p "Function cannot be empty"
17
+
}
18
+
19
+
@test "core.trap_add fails when signal is not supplied" {
20
+
run core.trap_add 'function'
21
+
22
+
assert_failure
23
+
assert_output -p "Must specify at least one signal"
24
+
}
25
+
26
+
@test "core.trap_add fails when signal is empty" {
27
+
run core.trap_add 'function'''
28
+
29
+
assert_failure
30
+
assert_output -p "Signal must not be an empty string"
31
+
}
32
+
12
33
@test "core.trap_add fails when function specified does not exist" {
0 commit comments