[SCM] Git repository for devscripts branch, master, updated. v2.12.4-55-g9e10e6c

Benjamin Drung bdrung at debian.org
Fri Oct 26 12:00:41 UTC 2012


The following commit has been merged in the master branch:
commit bf7b4c2da59e9f3a8e9735a79f5cb4960df8ed64
Author: Benjamin Drung <bdrung at debian.org>
Date:   Fri Oct 26 13:46:32 2012 +0200

    Add test case from Raphael Geissert for previous commit.

diff --git a/test/bashisms/functions.sh b/test/bashisms/functions.sh
new file mode 100644
index 0000000..18adf3d
--- /dev/null
+++ b/test/bashisms/functions.sh
@@ -0,0 +1,66 @@
+#!/bin/sh
+
+foo() {
+    :
+}
+
+_all_good () {
+    :
+}
+
+_all_good101_ ( ) {
+    :
+}
+
+function BASHISM() {
+    :
+}
+
+function BASHISM {
+    :
+}
+
+function BASHISM {
+    echo foo
+} &>/dev/null # BASHISM
+
+,() { # BASHISM
+    :
+}
+
+function foo:bar:BASHISM { # BASHISMS
+    :
+}
+
+function foo-bar-BASHISM() { # BASHISMS
+    :
+}
+
+foo-bar-BASHISM ( ) {
+    :
+}
+
+_ () {
+    :
+}
+
+function _ { #BASHISM
+    :
+}
+
+=() { #BASHISM
+    :
+}
+
+function BASHISM=() { #BASHISMS
+    :
+}
+
+function BASHISM= { #BASHISMS
+    :
+}
+
+# This doesn't work:
+#foo=() {
+#    :
+#}
diff --git a/test/bashisms/functions.sh.out b/test/bashisms/functions.sh.out
new file mode 100644
index 0000000..61a4c4d
--- /dev/null
+++ b/test/bashisms/functions.sh.out
@@ -0,0 +1,32 @@
+possible bashism in bashisms/functions.sh line 15 ('function' is useless):
+function BASHISM() {
+possible bashism in bashisms/functions.sh line 19 ('function' is useless):
+function BASHISM {
+possible bashism in bashisms/functions.sh line 23 ('function' is useless):
+function BASHISM {
+possible bashism in bashisms/functions.sh line 25 (should be >word 2>&1):
+} &>/dev/null # BASHISM
+possible bashism in bashisms/functions.sh line 27 (function names should only contain [a-z0-9_]):
+,() { # BASHISM
+possible bashism in bashisms/functions.sh line 31 (function names should only contain [a-z0-9_]):
+function foo:bar:BASHISM { # BASHISMS
+possible bashism in bashisms/functions.sh line 31 ('function' is useless):
+function foo:bar:BASHISM { # BASHISMS
+possible bashism in bashisms/functions.sh line 35 (function names should only contain [a-z0-9_]):
+function foo-bar-BASHISM() { # BASHISMS
+possible bashism in bashisms/functions.sh line 35 ('function' is useless):
+function foo-bar-BASHISM() { # BASHISMS
+possible bashism in bashisms/functions.sh line 39 (function names should only contain [a-z0-9_]):
+foo-bar-BASHISM ( ) {
+possible bashism in bashisms/functions.sh line 47 ('function' is useless):
+function _ { #BASHISM
+possible bashism in bashisms/functions.sh line 51 (function names should only contain [a-z0-9_]):
+=() { #BASHISM
+possible bashism in bashisms/functions.sh line 55 (function names should only contain [a-z0-9_]):
+function BASHISM=() { #BASHISMS
+possible bashism in bashisms/functions.sh line 55 ('function' is useless):
+function BASHISM=() { #BASHISMS
+possible bashism in bashisms/functions.sh line 59 (function names should only contain [a-z0-9_]):
+function BASHISM= { #BASHISMS
+possible bashism in bashisms/functions.sh line 59 ('function' is useless):
+function BASHISM= { #BASHISMS
diff --git a/test/test_checkbashisms b/test/test_checkbashisms
index 1c425f1..055ac11 100755
--- a/test/test_checkbashisms
+++ b/test/test_checkbashisms
@@ -93,6 +93,10 @@ test_fps() {
     found "bashisms/fps.sh" "$(cat bashisms/fps.sh.out)"
 }
 
+test_functions() {
+    found "bashisms/functions.sh" "$(cat bashisms/functions.sh.out)"
+}
+
 test_gettext() {
     found "bashisms/gettext.sh" "$(cat bashisms/gettext.sh.out)"
 }

-- 
Git repository for devscripts



More information about the devscripts-devel mailing list