t0014: introduce an alias testing suite

Introduce a testing suite that is dedicated to aliases. For now, check only if nested aliases work and if looping aliases are detected successfully. The looping aliases check for mixed execution is there but disabled, because it is blocking the test suite for a full minute. As soon as there is a solution for loops using external commands, it should be enabled. Signed-off-by: Tim Schumacher <timschumi@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Tim Schumacher committed Sep 16, 2018 at 09:50 UTC fef5f7fc43541e109674ab8f1d2baed733e9b7d3
1 file changed +40
t/t0014-alias.sh new
+40
@@ -0,0 +1,40 @@
1 +#!/bin/sh
2 +
3 +test_description='git command aliasing'
4 +
5 +. ./test-lib.sh
6 +
7 +test_expect_success 'nested aliases - internal execution' '
8 + git config alias.nested-internal-1 nested-internal-2 &&
9 + git config alias.nested-internal-2 status &&
10 + git nested-internal-1 >output &&
11 + test_i18ngrep "^On branch " output
12 +'
13 +
14 +test_expect_success 'nested aliases - mixed execution' '
15 + git config alias.nested-external-1 nested-external-2 &&
16 + git config alias.nested-external-2 "!git nested-external-3" &&
17 + git config alias.nested-external-3 status &&
18 + git nested-external-1 >output &&
19 + test_i18ngrep "^On branch " output
20 +'
21 +
22 +test_expect_success 'looping aliases - internal execution' '
23 + git config alias.loop-internal-1 loop-internal-2 &&
24 + git config alias.loop-internal-2 loop-internal-3 &&
25 + git config alias.loop-internal-3 loop-internal-2 &&
26 + test_must_fail git loop-internal-1 2>output &&
27 + test_i18ngrep "^fatal: alias loop detected: expansion of" output
28 +'
29 +
30 +# This test is disabled until external loops are fixed, because would block
31 +# the test suite for a full minute.
32 +#
33 +#test_expect_failure 'looping aliases - mixed execution' '
34 +# git config alias.loop-mixed-1 loop-mixed-2 &&
35 +# git config alias.loop-mixed-2 "!git loop-mixed-1" &&
36 +# test_must_fail git loop-mixed-1 2>output &&
37 +# test_i18ngrep "^fatal: alias loop detected: expansion of" output
38 +#'
39 +
40 +test_done