Skip to content

Commit 51bb4d6

Browse files
committed
Merge branch 'mh/test-local-canary'
We try to see if somebody runs our test suite with a shell that does not support "local" like bash/dash does. * mh/test-local-canary: t0000: check whether the shell supports the "local" keyword
2 parents da7996a + 01d3a52 commit 51bb4d6

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

t/t0000-basic.sh

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,31 @@ modification *should* take notice and update the test vectors here.
2020

2121
. ./test-lib.sh
2222

23+
try_local_x () {
24+
local x="local" &&
25+
echo "$x"
26+
}
27+
28+
# This test is an experiment to check whether any Git users are using
29+
# Shells that don't support the "local" keyword. "local" is not
30+
# POSIX-standard, but it is very widely supported by POSIX-compliant
31+
# shells, and if it doesn't cause problems for people, we would like
32+
# to be able to use it in Git code.
33+
#
34+
# For now, this is the only test that requires "local". If your shell
35+
# fails this test, you can ignore the failure, but please report the
36+
# problem to the Git mailing list <[email protected]>, as it might
37+
# convince us to continue avoiding the use of "local".
38+
test_expect_success 'verify that the running shell supports "local"' '
39+
x="notlocal" &&
40+
echo "local" >expected1 &&
41+
try_local_x >actual1 &&
42+
test_cmp expected1 actual1 &&
43+
echo "notlocal" >expected2 &&
44+
echo "$x" >actual2 &&
45+
test_cmp expected2 actual2
46+
'
47+
2348
################################################################
2449
# git init has been done in an empty repository.
2550
# make sure it is empty.

0 commit comments

Comments
 (0)