summaryrefslogtreecommitdiffstats
path: root/test/bashisms/traps.sh
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--test/bashisms/traps.sh17
-rw-r--r--test/bashisms/traps.sh.out18
2 files changed, 35 insertions, 0 deletions
diff --git a/test/bashisms/traps.sh b/test/bashisms/traps.sh
new file mode 100644
index 0000000..b357ce7
--- /dev/null
+++ b/test/bashisms/traps.sh
@@ -0,0 +1,17 @@
+#!/bin/sh
+
+trap foo ERR # BASHISM
+trap foo RETURN # BASHISM
+trap foo DEBUG # BASHISM
+
+trap "echo BASHISM" ERR
+trap "echo BASHISM" RETURN
+trap "echo BASHISM" DEBUG
+
+foo() {
+ echo ": dummy function"
+}
+
+trap $(foo BASHISM) ERR
+trap "$(foo BASHISM)" RETURN
+trap "echo $foo BASHISM" DEBUG
diff --git a/test/bashisms/traps.sh.out b/test/bashisms/traps.sh.out
new file mode 100644
index 0000000..300ad70
--- /dev/null
+++ b/test/bashisms/traps.sh.out
@@ -0,0 +1,18 @@
+possible bashism in bashisms/traps.sh line 3 (trap with ERR|DEBUG|RETURN):
+trap foo ERR # BASHISM
+possible bashism in bashisms/traps.sh line 4 (trap with ERR|DEBUG|RETURN):
+trap foo RETURN # BASHISM
+possible bashism in bashisms/traps.sh line 5 (trap with ERR|DEBUG|RETURN):
+trap foo DEBUG # BASHISM
+possible bashism in bashisms/traps.sh line 7 (trap with ERR|DEBUG|RETURN):
+trap "echo BASHISM" ERR
+possible bashism in bashisms/traps.sh line 8 (trap with ERR|DEBUG|RETURN):
+trap "echo BASHISM" RETURN
+possible bashism in bashisms/traps.sh line 9 (trap with ERR|DEBUG|RETURN):
+trap "echo BASHISM" DEBUG
+possible bashism in bashisms/traps.sh line 15 (trap with ERR|DEBUG|RETURN):
+trap $(foo BASHISM) ERR
+possible bashism in bashisms/traps.sh line 16 (trap with ERR|DEBUG|RETURN):
+trap "$(foo BASHISM)" RETURN
+possible bashism in bashisms/traps.sh line 17 (trap with ERR|DEBUG|RETURN):
+trap "echo $foo BASHISM" DEBUG