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

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


The following commit has been merged in the master branch:
commit 6ac34c6e725d8d4eccba7aa58c6f5d2dbdd2c4fc
Author: Benjamin Drung <bdrung at debian.org>
Date:   Sat Nov 10 23:48:07 2012 +0100

    Add test case from Raphael Geissert for previous commit.

diff --git a/test/bashisms/tilde-expansion.sh b/test/bashisms/tilde-expansion.sh
new file mode 100644
index 0000000..e58069a
--- /dev/null
+++ b/test/bashisms/tilde-expansion.sh
@@ -0,0 +1,41 @@
+#!/bin/sh
+
+echo tilde alone: ~/
+echo tilde with name: ~root/
+
+cd ; cd - >/dev/null
+
+echo BASHISM: tilde plus: ~+
+echo BASHISM: tilde minus: ~-
+
+pushd ~ >/dev/null 2>&1	    # BASHISM
+for i in $(seq 1 9); do
+    pushd / >/dev/null 2>&1 # BASHISM
+done
+
+echo BASHISM: tilde plus n: ~+1
+echo BASHISM: tilde implicit plus n: ~1
+echo BASHISM: tilde minus n: ~-1
+
+echo BASHISM: tilde plus 10: ~+10
+echo BASHISM: tilde implicit plus 10: ~10
+echo BASHISM: tilde minus 10: ~-10
+
+echo BASHISM=~-/bin
+echo BASHISM=/:~+/bin/
+BASHISM=~-/bin ; echo $BASHISM
+BASHISM=/:~+/bin/ ; echo $BASHISM
+
+echo nothing wrong here: ~+foo/
+echo nothing wrong here: ~-moo/
+echo nothing wrong here: ~+1foo/
+echo nothing wrong here: ~1foo/
+echo nothing wrong here: ~-1moo/
+
+# Again, but without the slash
+echo nothing wrong here: ~+foo
+echo nothing wrong here: ~-moo
+echo nothing wrong here: ~+1foo
+echo nothing wrong here: ~1foo
+echo nothing wrong here: ~-1moo
+
diff --git a/test/bashisms/tilde-expansion.sh.out b/test/bashisms/tilde-expansion.sh.out
new file mode 100644
index 0000000..6ae792e
--- /dev/null
+++ b/test/bashisms/tilde-expansion.sh.out
@@ -0,0 +1,28 @@
+possible bashism in bashisms/tilde-expansion.sh line 8 (non-standard tilde expansion):
+echo BASHISM: tilde plus: ~+
+possible bashism in bashisms/tilde-expansion.sh line 9 (non-standard tilde expansion):
+echo BASHISM: tilde minus: ~-
+possible bashism in bashisms/tilde-expansion.sh line 11 ((push|pop)d):
+pushd ~ >/dev/null 2>&1	    # BASHISM
+possible bashism in bashisms/tilde-expansion.sh line 13 ((push|pop)d):
+    pushd / >/dev/null 2>&1 # BASHISM
+possible bashism in bashisms/tilde-expansion.sh line 16 (non-standard tilde expansion):
+echo BASHISM: tilde plus n: ~+1
+possible bashism in bashisms/tilde-expansion.sh line 17 (non-standard tilde expansion):
+echo BASHISM: tilde implicit plus n: ~1
+possible bashism in bashisms/tilde-expansion.sh line 18 (non-standard tilde expansion):
+echo BASHISM: tilde minus n: ~-1
+possible bashism in bashisms/tilde-expansion.sh line 20 (non-standard tilde expansion):
+echo BASHISM: tilde plus 10: ~+10
+possible bashism in bashisms/tilde-expansion.sh line 21 (non-standard tilde expansion):
+echo BASHISM: tilde implicit plus 10: ~10
+possible bashism in bashisms/tilde-expansion.sh line 22 (non-standard tilde expansion):
+echo BASHISM: tilde minus 10: ~-10
+possible bashism in bashisms/tilde-expansion.sh line 24 (non-standard tilde expansion):
+echo BASHISM=~-/bin
+possible bashism in bashisms/tilde-expansion.sh line 25 (non-standard tilde expansion):
+echo BASHISM=/:~+/bin/
+possible bashism in bashisms/tilde-expansion.sh line 26 (non-standard tilde expansion):
+BASHISM=~-/bin ; echo $BASHISM
+possible bashism in bashisms/tilde-expansion.sh line 27 (non-standard tilde expansion):
+BASHISM=/:~+/bin/ ; echo $BASHISM
diff --git a/test/test_checkbashisms b/test/test_checkbashisms
index 1e2da38..d890812 100755
--- a/test/test_checkbashisms
+++ b/test/test_checkbashisms
@@ -175,6 +175,10 @@ test_subshell_no_arith() {
     clean "bashisms/subshell-no-arith.sh"
 }
 
+test_tilde_expansion() {
+    found "bashisms/tilde-expansion.sh" "$(cat bashisms/tilde-expansion.sh.out)"
+}
+
 test_traps() {
     found "bashisms/traps.sh" "$(cat bashisms/traps.sh.out)"
 }

-- 
Git repository for devscripts



More information about the devscripts-devel mailing list