chainlint: add test of pathological case which triggered false positive
This extract from contrib/subtree/t7900 triggered a false positive due to three chainlint limitations: * recognizing only a "blessed" set of here-doc tag names in a subshell ("EOF", "EOT", "INPUT_END"), of which "TXT" is not a member * inability to recognize multi-line $(...) when the first statement of the body is cuddled with the opening "$(" * inability to recognize multiple constructs on a single line, such as opening a multi-line $(...) and starting a here-doc Now that all of these shortcomings have been addressed, turn this rather pathological bit of shell coding into a chainlint test case. Signed-off-by: Eric Sunshine <sunshine@sunshineco.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Eric Sunshine committed
Aug 13, 2018 at 04:47 UTC
4f69176feb1b441d46dab7a0ac679df7edf44f5f
2 files changed
+32
t/chainlint/t7900-subtree.expect
new
+10
@@ -0,0 +1,10 @@
1
+(
2
+ chks="sub1sub2sub3sub4" &&
3
+ chks_sub=$(cat | sed 's,^,sub dir/,'
4
+>>) &&
5
+ chkms="main-sub1main-sub2main-sub3main-sub4" &&
6
+ chkms_sub=$(cat | sed 's,^,sub dir/,'
7
+>>) &&
8
+ subfiles=$(git ls-files) &&
9
+ check_equal "$subfiles" "$chkms$chks"
10
+>)
t/chainlint/t7900-subtree.test
new
+22
@@ -0,0 +1,22 @@
1
+(
2
+ chks="sub1
3
+sub2
4
+sub3
5
+sub4" &&
6
+ chks_sub=$(cat <<TXT | sed 's,^,sub dir/,'
7
+$chks
8
+TXT
9
+) &&
10
+ chkms="main-sub1
11
+main-sub2
12
+main-sub3
13
+main-sub4" &&
14
+ chkms_sub=$(cat <<TXT | sed 's,^,sub dir/,'
15
+$chkms
16
+TXT
17
+) &&
18
+
19
+ subfiles=$(git ls-files) &&
20
+ check_equal "$subfiles" "$chkms
21
+$chks"
22
+)