tests: move code to run tests under bash into a helper library
The following patch will add tests for the bash prompt functions as a new test script, which also has to be run under bash. Signed-off-by: SZEDER Gábor <szeder@ira.uka.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
SZEDER Gábor committed
May 9, 2012 at 02:44 UTC
f8891cfa2a16d040d799f281684851fa7b2a0c2b
2 files changed
+19
-13
t/lib-bash.sh
new
+18
@@ -0,0 +1,18 @@
1
+#!/bin/sh
2
+#
3
+# Ensures that tests are run under Bash; primarily intended for running tests
4
+# of the completion script.
5
+
6
+if test -n "$BASH" && test -z "$POSIXLY_CORRECT"; then
7
+ # we are in full-on bash mode
8
+ true
9
+elif type bash >/dev/null 2>&1; then
10
+ # execute in full-on bash mode
11
+ unset POSIXLY_CORRECT
12
+ exec bash "$0" "$@"
13
+else
14
+ echo '1..0 #SKIP skipping bash completion tests; bash not available'
15
+ exit 0
16
+fi
17
+
18
+. ./test-lib.sh
t/t9902-completion.sh
+1
-13
@@ -3,21 +3,9 @@
3
# Copyright (c) 2012 Felipe Contreras
4
#
5
6
-if test -n "$BASH" && test -z "$POSIXLY_CORRECT"; then
7
- # we are in full-on bash mode
8
- true
9
-elif type bash >/dev/null 2>&1; then
10
- # execute in full-on bash mode
11
- unset POSIXLY_CORRECT
12
- exec bash "$0" "$@"
13
-else
14
- echo '1..0 #SKIP skipping bash completion tests; bash not available'
15
- exit 0
16
-fi
17
-
6
test_description='test bash completion'
7
20
-. ./test-lib.sh
8
+. ./lib-bash.sh
9
10
complete ()
11
{