summaryrefslogtreecommitdiffstats
path: root/test/bashisms/functions.sh
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--test/bashisms/functions.sh66
-rw-r--r--test/bashisms/functions.sh.out32
2 files changed, 98 insertions, 0 deletions
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