t0003: use named parameters in attr_check()
We had named the parameters in attr_check() but $2 was being used instead of $expect. Make all variable accesses in attr_check() use named variables instead of numbered arguments for clarity. While we're at it, add variable assignments to the &&-chain. These aren't ever expected to fail but if a future developer ever adds some code above the assignments and they could fail in some way, the intact &&-chain will ensure that the failure is caught. Signed-off-by: Denton Liu <liu.denton@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Denton Liu committed
Dec 20, 2019 at 10:15 UTC
3738439c7779acf2dafadbbc488bb222c94a2b12
1 file changed
+4
-7
t/t0003-attributes.sh
+4
-7
@@ -5,19 +5,16 @@ test_description=gitattributes
5
. ./test-lib.sh
6
7
attr_check () {
8
- path="$1" expect="$2"
8
+ path="$1" expect="$2" git_opts="$3" &&
9
10
- git $3 check-attr test -- "$path" >actual 2>err &&
11
- echo "$path: test: $2" >expect &&
10
+ git $git_opts check-attr test -- "$path" >actual 2>err &&
11
+ echo "$path: test: $expect" >expect &&
12
test_cmp expect actual &&
13
test_line_count = 0 err
14
}
15
16
attr_check_quote () {
17
-
18
- path="$1"
19
- quoted_path="$2"
20
- expect="$3"
17
+ path="$1" quoted_path="$2" expect="$3" &&
18
19
git check-attr test -- "$path" >actual &&
20
echo "\"$quoted_path\": test: $expect" >expect &&