[SCM] Git repository for devscripts branch, master, updated. v2.12.4-43-g227b8b8

Benjamin Drung bdrung at debian.org
Thu Oct 25 20:17:06 UTC 2012


The following commit has been merged in the master branch:
commit 7dad39cc0e5e233ff493fc7791c58ccd7497c5b7
Author: Benjamin Drung <bdrung at debian.org>
Date:   Thu Oct 25 21:53:25 2012 +0200

    Add test case from Raphael Geissert for previous commit.

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
diff --git a/test/test_checkbashisms b/test/test_checkbashisms
index 6cede76..b94abd9 100755
--- a/test/test_checkbashisms
+++ b/test/test_checkbashisms
@@ -129,6 +129,10 @@ test_subshell_no_arith() {
     clean "bashisms/subshell-no-arith.sh"
 }
 
+test_traps() {
+    found "bashisms/traps.sh" "$(cat bashisms/traps.sh.out)"
+}
+
 test_unknown_fns() {
     found "bashisms/unknown-fns.sh" "$(cat bashisms/unknown-fns.sh.out)"
 }

-- 
Git repository for devscripts



More information about the devscripts-devel mailing list