diff mbox series

[v2,3/5] help tests: add test for --config output

Message ID patch-v2-3.5-258282095de-20210910T112545Z-avarab@gmail.com (mailing list archive)
State Superseded
Headers show
Series help: fix usage nits & bugs, completion shellscript->C | expand

Commit Message

Ævar Arnfjörð Bjarmason Sept. 10, 2021, 11:28 a.m. UTC
Add a missing test for checking what the --config output added in
ac68a93fd2 (help: add --config to list all available config,
2018-05-26) looks like. We should not be emitting anything except
config variables and the brief usage information at the end here.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
---
 t/t0012-help.sh | 13 +++++++++++++
 1 file changed, 13 insertions(+)

Comments

Junio C Hamano Sept. 11, 2021, 1:32 a.m. UTC | #1
Ævar Arnfjörð Bjarmason  <avarab@gmail.com> writes:

> Add a missing test for checking what the --config output added in
> ac68a93fd2 (help: add --config to list all available config,
> 2018-05-26) looks like. We should not be emitting anything except
> config variables and the brief usage information at the end here.
>
> Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
> ---
>  t/t0012-help.sh | 13 +++++++++++++
>  1 file changed, 13 insertions(+)
>
> diff --git a/t/t0012-help.sh b/t/t0012-help.sh
> index c3aa016fd30..595bf81f133 100755
> --- a/t/t0012-help.sh
> +++ b/t/t0012-help.sh
> @@ -77,6 +77,19 @@ test_expect_success 'git help -g' '
>  	test_i18ngrep "^   tutorial   " help.output
>  '
>  
> +test_expect_success 'git help -c' '
> +	git help -c >help.output &&
> +	cat >expect <<-\EOF &&
> +
> +	'"'"'git help config'"'"' for more information

	'\''git help config'\'' for more information

is a tad shorter.

> +	EOF
> +	grep -v -E \
> +		-e "^[^.]+\.[^.]+$" \
> +		-e "^[^.]+\.[^.]+\.[^.]+$" \

I have to question if there is much value in this test, especially
the latter pattern.  A configuration variable with three-level name
can have any byte, including a dot, in its second level, so
rejecting a name with more than three dots in it can over-filter,
depending on what new keys we'll document in the future.

> +		help.output >actual &&
> +	test_cmp expect actual
> +'
> +
>  test_expect_success 'generate builtin list' '
>  	git --list-cmds=builtins >builtins
>  '
Ævar Arnfjörð Bjarmason Sept. 11, 2021, 2:25 a.m. UTC | #2
On Fri, Sep 10 2021, Junio C Hamano wrote:

> Ævar Arnfjörð Bjarmason  <avarab@gmail.com> writes:
>
>> Add a missing test for checking what the --config output added in
>> ac68a93fd2 (help: add --config to list all available config,
>> 2018-05-26) looks like. We should not be emitting anything except
>> config variables and the brief usage information at the end here.
>>
>> Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
>> ---
>>  t/t0012-help.sh | 13 +++++++++++++
>>  1 file changed, 13 insertions(+)
>>
>> diff --git a/t/t0012-help.sh b/t/t0012-help.sh
>> index c3aa016fd30..595bf81f133 100755
>> --- a/t/t0012-help.sh
>> +++ b/t/t0012-help.sh
>> @@ -77,6 +77,19 @@ test_expect_success 'git help -g' '
>>  	test_i18ngrep "^   tutorial   " help.output
>>  '
>>  
>> +test_expect_success 'git help -c' '
>> +	git help -c >help.output &&
>> +	cat >expect <<-\EOF &&
>> +
>> +	'"'"'git help config'"'"' for more information
>
> 	'\''git help config'\'' for more information
>
> is a tad shorter.

Thanks.

>> +	EOF
>> +	grep -v -E \
>> +		-e "^[^.]+\.[^.]+$" \
>> +		-e "^[^.]+\.[^.]+\.[^.]+$" \
>
> I have to question if there is much value in this test, especially
> the latter pattern.  A configuration variable with three-level name
> can have any byte, including a dot, in its second level, so
> rejecting a name with more than three dots in it can over-filter,
> depending on what new keys we'll document in the future.

This is from what we extract from the headers in the documentation, so
it's all strings like:

    foo.<name>.bar

In cases where there's some three-level arbitrary string key. That seems
unlikely to change.
Philip Oakley Sept. 13, 2021, 7:21 p.m. UTC | #3
On 10/09/2021 12:28, Ævar Arnfjörð Bjarmason wrote:
> Add a missing test for checking what the --config output added in
> ac68a93fd2 (help: add --config to list all available config,

This ref should be 3ac68a93fd2
Probable hand editing mistake - it's Ok in 4/5

> 2018-05-26) looks like. We should not be emitting anything except
> config variables and the brief usage information at the end here.
>
> Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
> ---
>  t/t0012-help.sh | 13 +++++++++++++
>  1 file changed, 13 insertions(+)
>
> diff --git a/t/t0012-help.sh b/t/t0012-help.sh
> index c3aa016fd30..595bf81f133 100755
> --- a/t/t0012-help.sh
> +++ b/t/t0012-help.sh
> @@ -77,6 +77,19 @@ test_expect_success 'git help -g' '
>  	test_i18ngrep "^   tutorial   " help.output
>  '
>  
> +test_expect_success 'git help -c' '
> +	git help -c >help.output &&
> +	cat >expect <<-\EOF &&
> +
> +	'"'"'git help config'"'"' for more information
> +	EOF
> +	grep -v -E \
> +		-e "^[^.]+\.[^.]+$" \
> +		-e "^[^.]+\.[^.]+\.[^.]+$" \
> +		help.output >actual &&
> +	test_cmp expect actual
> +'
> +
>  test_expect_success 'generate builtin list' '
>  	git --list-cmds=builtins >builtins
>  '
diff mbox series

Patch

diff --git a/t/t0012-help.sh b/t/t0012-help.sh
index c3aa016fd30..595bf81f133 100755
--- a/t/t0012-help.sh
+++ b/t/t0012-help.sh
@@ -77,6 +77,19 @@  test_expect_success 'git help -g' '
 	test_i18ngrep "^   tutorial   " help.output
 '
 
+test_expect_success 'git help -c' '
+	git help -c >help.output &&
+	cat >expect <<-\EOF &&
+
+	'"'"'git help config'"'"' for more information
+	EOF
+	grep -v -E \
+		-e "^[^.]+\.[^.]+$" \
+		-e "^[^.]+\.[^.]+\.[^.]+$" \
+		help.output >actual &&
+	test_cmp expect actual
+'
+
 test_expect_success 'generate builtin list' '
 	git --list-cmds=builtins >builtins
 '