[SCM] Git repository for devscripts branch, master, updated. v2.12.4-72-gcf18b4b

Benjamin Drung bdrung at debian.org
Sat Nov 10 23:00:40 UTC 2012


The following commit has been merged in the master branch:
commit 321a4bbc718253b0a779ccc8827956ee6b34f5a9
Author: Benjamin Drung <bdrung at debian.org>
Date:   Sat Nov 10 23:57:39 2012 +0100

    Add test case from Raphael Geissert for previous commit.

diff --git a/test/bashisms/array-expansion.sh b/test/bashisms/array-expansion.sh
new file mode 100644
index 0000000..ca2b57a
--- /dev/null
+++ b/test/bashisms/array-expansion.sh
@@ -0,0 +1,60 @@
+#!/bin/sh
+
+# This is a TO DO, but irrelevant to this test case:
+foo=(foo bar moo BASH ISM)
+
+n=1
+
+echo BASHISM ${foo[1]%r}
+echo BASHISM ${foo[$n]%r}
+echo BASHISM ${foo[*]%o}
+echo BASHISM ${foo[@]%o}
+
+echo BASHISM ${foo[1]%%r}
+echo BASHISM ${foo[$n]%%r}
+echo BASHISM ${foo[*]%%o}
+echo BASHISM ${foo[@]%%o}
+
+echo BASHISM ${foo[1]#*a}
+echo BASHISM ${foo[$n]#*a}
+echo BASHISM ${foo[*]#*o}
+echo BASHISM ${foo[@]#*o}
+
+echo BASHISM ${foo[1]##*a}
+echo BASHISM ${foo[$n]##*a}
+echo BASHISM ${foo[*]##*o}
+echo BASHISM ${foo[@]##*o}
+
+echo BASHISM ${#foo[1]}
+echo BASHISM ${#foo[$n]}
+echo BASHISM ${#foo[*]}
+echo BASHISM ${#foo[@]}
+
+# Technically, there are two bashisms here, but I'm happy if it at
+# least matches one. The regexes become more complex without real gain
+# otherwise. (hence the "BASH ISMS", with the extra space)
+
+echo BASHISM BASH ISMS ${foo[1]^*a}
+echo BASHISM BASH ISMS ${foo[$n]^*a}
+echo BASHISM BASH ISMS ${foo[*]^*o}
+echo BASHISM BASH ISMS ${foo[@]^*o}
+
+echo BASHISM BASH ISMS ${foo[1]^^*a}
+echo BASHISM BASH ISMS ${foo[$n]^^*a}
+echo BASHISM BASH ISMS ${foo[*]^^*o}
+echo BASHISM BASH ISMS ${foo[@]^^*o}
+
+echo BASHISM BASH ISMS ${foo[1],*a}
+echo BASHISM BASH ISMS ${foo[$n],*a}
+echo BASHISM BASH ISMS ${foo[*],*a}
+echo BASHISM BASH ISMS ${foo[@],*a}
+
+echo BASHISM BASH ISMS ${foo[1],,*a}
+echo BASHISM BASH ISMS ${foo[$n],,*a}
+echo BASHISM BASH ISMS ${foo[*],,*a}
+echo BASHISM BASH ISMS ${foo[@],,*a}
+
+echo BASHISM BASH ISMS ${foo[1]/a/R}
+echo BASHISM BASH ISMS ${foo[$n]/a/R}
+echo BASHISM BASH ISMS ${foo[*]/a/R}
+echo BASHISM BASH ISMS ${foo[@]/a/R}
diff --git a/test/bashisms/array-expansion.sh.out b/test/bashisms/array-expansion.sh.out
new file mode 100644
index 0000000..d14bea0
--- /dev/null
+++ b/test/bashisms/array-expansion.sh.out
@@ -0,0 +1,80 @@
+possible bashism in bashisms/array-expansion.sh line 8 (bash arrays, ${name[0|*|@]}):
+echo BASHISM ${foo[1]%r}
+possible bashism in bashisms/array-expansion.sh line 9 (bash arrays, ${name[0|*|@]}):
+echo BASHISM ${foo[$n]%r}
+possible bashism in bashisms/array-expansion.sh line 10 (bash arrays, ${name[0|*|@]}):
+echo BASHISM ${foo[*]%o}
+possible bashism in bashisms/array-expansion.sh line 11 (bash arrays, ${name[0|*|@]}):
+echo BASHISM ${foo[@]%o}
+possible bashism in bashisms/array-expansion.sh line 13 (bash arrays, ${name[0|*|@]}):
+echo BASHISM ${foo[1]%%r}
+possible bashism in bashisms/array-expansion.sh line 14 (bash arrays, ${name[0|*|@]}):
+echo BASHISM ${foo[$n]%%r}
+possible bashism in bashisms/array-expansion.sh line 15 (bash arrays, ${name[0|*|@]}):
+echo BASHISM ${foo[*]%%o}
+possible bashism in bashisms/array-expansion.sh line 16 (bash arrays, ${name[0|*|@]}):
+echo BASHISM ${foo[@]%%o}
+possible bashism in bashisms/array-expansion.sh line 18 (bash arrays, ${name[0|*|@]}):
+echo BASHISM ${foo[1]#*a}
+possible bashism in bashisms/array-expansion.sh line 19 (bash arrays, ${name[0|*|@]}):
+echo BASHISM ${foo[$n]#*a}
+possible bashism in bashisms/array-expansion.sh line 20 (bash arrays, ${name[0|*|@]}):
+echo BASHISM ${foo[*]#*o}
+possible bashism in bashisms/array-expansion.sh line 21 (bash arrays, ${name[0|*|@]}):
+echo BASHISM ${foo[@]#*o}
+possible bashism in bashisms/array-expansion.sh line 23 (bash arrays, ${name[0|*|@]}):
+echo BASHISM ${foo[1]##*a}
+possible bashism in bashisms/array-expansion.sh line 24 (bash arrays, ${name[0|*|@]}):
+echo BASHISM ${foo[$n]##*a}
+possible bashism in bashisms/array-expansion.sh line 25 (bash arrays, ${name[0|*|@]}):
+echo BASHISM ${foo[*]##*o}
+possible bashism in bashisms/array-expansion.sh line 26 (bash arrays, ${name[0|*|@]}):
+echo BASHISM ${foo[@]##*o}
+possible bashism in bashisms/array-expansion.sh line 28 (bash arrays, ${name[0|*|@]}):
+echo BASHISM ${#foo[1]}
+possible bashism in bashisms/array-expansion.sh line 29 (bash arrays, ${name[0|*|@]}):
+echo BASHISM ${#foo[$n]}
+possible bashism in bashisms/array-expansion.sh line 30 (bash arrays, ${name[0|*|@]}):
+echo BASHISM ${#foo[*]}
+possible bashism in bashisms/array-expansion.sh line 31 (bash arrays, ${name[0|*|@]}):
+echo BASHISM ${#foo[@]}
+possible bashism in bashisms/array-expansion.sh line 37 (bash arrays, ${name[0|*|@]}):
+echo BASHISM BASH ISMS ${foo[1]^*a}
+possible bashism in bashisms/array-expansion.sh line 38 (bash arrays, ${name[0|*|@]}):
+echo BASHISM BASH ISMS ${foo[$n]^*a}
+possible bashism in bashisms/array-expansion.sh line 39 (bash arrays, ${name[0|*|@]}):
+echo BASHISM BASH ISMS ${foo[*]^*o}
+possible bashism in bashisms/array-expansion.sh line 40 (bash arrays, ${name[0|*|@]}):
+echo BASHISM BASH ISMS ${foo[@]^*o}
+possible bashism in bashisms/array-expansion.sh line 42 (bash arrays, ${name[0|*|@]}):
+echo BASHISM BASH ISMS ${foo[1]^^*a}
+possible bashism in bashisms/array-expansion.sh line 43 (bash arrays, ${name[0|*|@]}):
+echo BASHISM BASH ISMS ${foo[$n]^^*a}
+possible bashism in bashisms/array-expansion.sh line 44 (bash arrays, ${name[0|*|@]}):
+echo BASHISM BASH ISMS ${foo[*]^^*o}
+possible bashism in bashisms/array-expansion.sh line 45 (bash arrays, ${name[0|*|@]}):
+echo BASHISM BASH ISMS ${foo[@]^^*o}
+possible bashism in bashisms/array-expansion.sh line 47 (bash arrays, ${name[0|*|@]}):
+echo BASHISM BASH ISMS ${foo[1],*a}
+possible bashism in bashisms/array-expansion.sh line 48 (bash arrays, ${name[0|*|@]}):
+echo BASHISM BASH ISMS ${foo[$n],*a}
+possible bashism in bashisms/array-expansion.sh line 49 (bash arrays, ${name[0|*|@]}):
+echo BASHISM BASH ISMS ${foo[*],*a}
+possible bashism in bashisms/array-expansion.sh line 50 (bash arrays, ${name[0|*|@]}):
+echo BASHISM BASH ISMS ${foo[@],*a}
+possible bashism in bashisms/array-expansion.sh line 52 (bash arrays, ${name[0|*|@]}):
+echo BASHISM BASH ISMS ${foo[1],,*a}
+possible bashism in bashisms/array-expansion.sh line 53 (bash arrays, ${name[0|*|@]}):
+echo BASHISM BASH ISMS ${foo[$n],,*a}
+possible bashism in bashisms/array-expansion.sh line 54 (bash arrays, ${name[0|*|@]}):
+echo BASHISM BASH ISMS ${foo[*],,*a}
+possible bashism in bashisms/array-expansion.sh line 55 (bash arrays, ${name[0|*|@]}):
+echo BASHISM BASH ISMS ${foo[@],,*a}
+possible bashism in bashisms/array-expansion.sh line 57 (bash arrays, ${name[0|*|@]}):
+echo BASHISM BASH ISMS ${foo[1]/a/R}
+possible bashism in bashisms/array-expansion.sh line 58 (bash arrays, ${name[0|*|@]}):
+echo BASHISM BASH ISMS ${foo[$n]/a/R}
+possible bashism in bashisms/array-expansion.sh line 59 (bash arrays, ${name[0|*|@]}):
+echo BASHISM BASH ISMS ${foo[*]/a/R}
+possible bashism in bashisms/array-expansion.sh line 60 (bash arrays, ${name[0|*|@]}):
+echo BASHISM BASH ISMS ${foo[@]/a/R}
diff --git a/test/test_checkbashisms b/test/test_checkbashisms
index c086ae8..d0ca11d 100755
--- a/test/test_checkbashisms
+++ b/test/test_checkbashisms
@@ -47,6 +47,10 @@ test_arith() {
     found "bashisms/arith.sh" "$(cat bashisms/arith.sh.out)"
 }
 
+test_array_expansion() {
+    found "bashisms/array-expansion.sh" "$(cat bashisms/array-expansion.sh.out)"
+}
+
 test_ash_setvar() {
     found "bashisms/ash-setvar.sh" "$(cat bashisms/ash-setvar.sh.out)"
 }

-- 
Git repository for devscripts



More information about the devscripts-devel mailing list