t0450: *.txt -> *.adoc fixes
After 1f010d6bdf (doc: use .adoc extension for AsciiDoc files, 2025-01-20), we no longer matched any files in this test. The result is that we did not test for mismatches in the documentation and --help output. Adjust the test to look at the renamed *.adoc files. Signed-off-by: Todd Zullinger <tmz@pobox.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Todd Zullinger committed
Mar 3, 2025 at 15:43 UTC
82deaae3b94d59caf13ea21c980ab386df6dac9e
2 files changed
+25
-25
t/t0450-txt-doc-vs-help.sh
+25
-25
@@ -1,6 +1,6 @@
1
#!/bin/sh
2
3
-test_description='assert (unbuilt) Documentation/*.txt and -h output
3
+test_description='assert (unbuilt) Documentation/*.adoc and -h output
4
5
Run this with --debug to see a summary of where we still fail to make
6
the two versions consistent with one another.'
@@ -11,11 +11,11 @@ test_expect_success 'setup: list of builtins' '
11
git --list-cmds=builtins >builtins
12
'
13
14
-test_expect_success 'list of txt and help mismatches is sorted' '
15
- sort -u "$TEST_DIRECTORY"/t0450/txt-help-mismatches >expect &&
16
- if ! test_cmp expect "$TEST_DIRECTORY"/t0450/txt-help-mismatches
14
+test_expect_success 'list of adoc and help mismatches is sorted' '
15
+ sort -u "$TEST_DIRECTORY"/t0450/adoc-help-mismatches >expect &&
16
+ if ! test_cmp expect "$TEST_DIRECTORY"/t0450/adoc-help-mismatches
17
then
18
- BUG "please keep the list of txt and help mismatches sorted"
18
+ BUG "please keep the list of adoc and help mismatches sorted"
19
fi
20
'
21
@@ -40,20 +40,20 @@ help_to_synopsis () {
40
echo "$out"
41
}
42
43
-builtin_to_txt () {
44
- echo "$GIT_BUILD_DIR/Documentation/git-$1.txt"
43
+builtin_to_adoc () {
44
+ echo "$GIT_BUILD_DIR/Documentation/git-$1.adoc"
45
}
46
47
-txt_to_synopsis () {
47
+adoc_to_synopsis () {
48
builtin="$1" &&
49
out_dir="out/$builtin" &&
50
- out="$out_dir/txt.synopsis" &&
50
+ out="$out_dir/adoc.synopsis" &&
51
if test -f "$out"
52
then
53
echo "$out" &&
54
return 0
55
fi &&
56
- b2t="$(builtin_to_txt "$builtin")" &&
56
+ b2t="$(builtin_to_adoc "$builtin")" &&
57
sed -n \
58
-E '/^\[(verse|synopsis)\]$/,/^$/ {
59
/^$/d;
@@ -109,29 +109,29 @@ do
109
fi
110
'
111
112
- txt="$(builtin_to_txt "$builtin")" &&
113
- preq="$(echo BUILTIN_TXT_$builtin | tr '[:lower:]-' '[:upper:]_')" &&
112
+ adoc="$(builtin_to_adoc "$builtin")" &&
113
+ preq="$(echo BUILTIN_ADOC_$builtin | tr '[:lower:]-' '[:upper:]_')" &&
114
115
- if test -f "$txt"
115
+ if test -f "$adoc"
116
then
117
test_set_prereq "$preq"
118
fi &&
119
120
- # *.txt output assertions
121
- test_expect_success "$preq" "$builtin *.txt SYNOPSIS has dashed labels" '
122
- check_dashed_labels "$(txt_to_synopsis "$builtin")"
120
+ # *.adoc output assertions
121
+ test_expect_success "$preq" "$builtin *.adoc SYNOPSIS has dashed labels" '
122
+ check_dashed_labels "$(adoc_to_synopsis "$builtin")"
123
'
124
125
- # *.txt output consistency assertions
125
+ # *.adoc output consistency assertions
126
result=
127
- if grep -q "^$builtin$" "$TEST_DIRECTORY"/t0450/txt-help-mismatches
127
+ if grep -q "^$builtin$" "$TEST_DIRECTORY"/t0450/adoc-help-mismatches
128
then
129
result=failure
130
else
131
result=success
132
fi &&
133
test_expect_$result "$preq" "$builtin -h output and SYNOPSIS agree" '
134
- t2s="$(txt_to_synopsis "$builtin")" &&
134
+ t2s="$(adoc_to_synopsis "$builtin")" &&
135
if test "$builtin" = "merge-tree"
136
then
137
test_when_finished "rm -f t2s.new" &&
@@ -140,17 +140,17 @@ do
140
fi &&
141
h2s="$(help_to_synopsis "$builtin")" &&
142
143
- # The *.txt and -h use different spacing for the
143
+ # The *.adoc and -h use different spacing for the
144
# alignment of continued usage output, normalize it.
145
- align_after_nl "$builtin" <"$t2s" >txt &&
145
+ align_after_nl "$builtin" <"$t2s" >adoc &&
146
align_after_nl "$builtin" <"$h2s" >help &&
147
- test_cmp txt help
147
+ test_cmp adoc help
148
'
149
150
- if test_have_prereq "$preq" && test -e txt && test -e help
150
+ if test_have_prereq "$preq" && test -e adoc && test -e help
151
then
152
test_debug '
153
- if test_cmp txt help >cmp 2>/dev/null
153
+ if test_cmp adoc help >cmp 2>/dev/null
154
then
155
echo "=== DONE: $builtin ==="
156
else
@@ -161,7 +161,7 @@ do
161
162
# Not in test_expect_success in case --run is being
163
# used with --debug
164
- rm -f txt help tmp 2>/dev/null
164
+ rm -f adoc help tmp 2>/dev/null
165
fi
166
done <builtins
167