Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorÆvar Arnfjörð Bjarmason <avarab@gmail.com>2022-02-21 22:38:46 +0300
committerJunio C Hamano <gitster@pobox.com>2022-02-24 00:41:36 +0300
commitbf7eed75b90756c960da4828476b669a358df05b (patch)
tree0556f5e0405de6e9dd626184827ad3d11b700968 /t/t0012-help.sh
parentcd87ce7d0def6b6efeb1ae688bde217a0a47c9eb (diff)
help tests: test "git" and "git help [-a|-g] spacing
There's logic in "help.c"'s "print_cmd_by_category()" to emit "help" output with particular spacing, which doesn't make much sense when emitting only one section with "help -g". Let's add tests for the current spacing in preparation for a subsequent whitespace formatting fix, and make sure that that fix doesn't cause regressions for the "git" and "git help" output. Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t0012-help.sh')
-rwxr-xr-xt/t0012-help.sh45
1 files changed, 45 insertions, 0 deletions
diff --git a/t/t0012-help.sh b/t/t0012-help.sh
index cbd725ccac..9ac3f5d3c4 100755
--- a/t/t0012-help.sh
+++ b/t/t0012-help.sh
@@ -138,6 +138,51 @@ test_expect_success 'git help --config-sections-for-completion' '
test_cmp human.munged sections
'
+test_section_spacing () {
+ cat >expect &&
+ "$@" >out &&
+ grep -E "(^[^ ]|^$)" out >actual
+}
+
+test_section_spacing_trailer () {
+ test_section_spacing "$@" &&
+ test_expect_code 1 git >out &&
+ sed -n '/list available subcommands/,$p' <out >>expect
+}
+
+
+for cmd in git "git help"
+do
+ test_expect_success "'$cmd' section spacing" '
+ test_section_spacing_trailer git help <<-\EOF &&
+ usage: git [--version] [--help] [-C <path>] [-c <name>=<value>]
+
+ These are common Git commands used in various situations:
+
+ start a working area (see also: git help tutorial)
+
+ work on the current change (see also: git help everyday)
+
+ examine the history and state (see also: git help revisions)
+
+ grow, mark and tweak your common history
+
+ collaborate (see also: git help workflows)
+
+ EOF
+ test_cmp expect actual
+ '
+done
+
+test_expect_success "'git help -g' section spacing" '
+ test_section_spacing_trailer git help -g <<-\EOF &&
+
+ The Git concept guides are:
+
+ EOF
+ test_cmp expect actual
+'
+
test_expect_success 'generate builtin list' '
mkdir -p sub &&
git --list-cmds=builtins >builtins