Skip to content

Commit f8891cf

Browse files
szedergitster
authored andcommitted
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>
1 parent a3935e6 commit f8891cf

File tree

2 files changed

+19
-13
lines changed

2 files changed

+19
-13
lines changed

t/lib-bash.sh

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,21 +3,9 @@
33
# Copyright (c) 2012 Felipe Contreras
44
#
55

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-
186
test_description='test bash completion'
197

20-
. ./test-lib.sh
8+
. ./lib-bash.sh
219

2210
complete ()
2311
{

0 commit comments

Comments
 (0)