mbox series

[v3,0/3] git config tests for "'git config ignores pairs ..."

Message ID 20230423134649.431783-1-rybak.a.v@gmail.com (mailing list archive)
Headers show
Series git config tests for "'git config ignores pairs ..." | expand

Message

Andrei Rybak April 23, 2023, 1:46 p.m. UTC
Clean up existing tests and add new tests in t1300-config.sh.

v1 cover letter:
  https://lore.kernel.org/git/20230414081352.810296-1-rybak.a.v@gmail.com/
v2 cover letter:
  https://lore.kernel.org/git/20230418175034.982433-1-rybak.a.v@gmail.com/

Changes since v2:
  - Patch 3 updates:
    - Added missing word "are" in commit message
    - Added signoff
    - Wrapped $1 and $2 in double quotes for consistency with
      `git grep -P 'local .*="?[$][1-9]"? &&$' -- t`
    - Added &&-chainging to function "test_missing_key"
    - Fixed quoting so that substitution of $key happens inside eval
    - Added tests about config subsections

Changes since v1:
  - Rewritten commit message for patch 2.
  - New RFC patch 3.

Andrei Rybak (3):
  t1300: drop duplicate test
  t1300: check stderr for "ignores pairs" tests
  t1300: add tests for missing keys

 t/t1300-config.sh | 33 ++++++++++++++++++++++-----------
 1 file changed, 22 insertions(+), 11 deletions(-)

Range diff against v2:
1:  cf812f4fa8 = 1:  cf812f4fa8 t1300: drop duplicate test
2:  b4132adea8 = 2:  b4132adea8 t1300: check stderr for "ignores pairs" tests
3:  6126f42449 ! 3:  ba536bf855 t1300: add tests for missing keys
    @@ Metadata
      ## Commit message ##
         t1300: add tests for missing keys
     
    -    There several tests in t1300-config.sh that validate failing invocations
    -    of "git config".  However, there are no tests that check what happens
    -    when "git config" is asked to retrieve a value for a missing key.
    +    There are several tests in t1300-config.sh that validate failing
    +    invocations of "git config".  However, there are no tests that check
    +    what happens when "git config" is asked to retrieve a value for a
    +    missing key.
     
    -    Add tests that check this for various combinations of "<section>.<key>".
    +    Add tests that check this for various combinations of "<section>.<key>"
    +    and "<section>.<subsection>.<key>".
    +
    +    Signed-off-by: Andrei Rybak <rybak.a.v@gmail.com>
     
      ## t/t1300-config.sh ##
     @@ t/t1300-config.sh: test_expect_success 'subsections are not canonicalized by git-config' '
    @@ t/t1300-config.sh: test_expect_success 'subsections are not canonicalized by git
      '
      
     +test_missing_key () {
    -+	local key=$1
    -+	local title=$2
    -+	test_expect_success "value for $title is not printed" "
    -+		test_must_fail git config $key >out 2>err &&
    ++	local key="$1" &&
    ++	local title="$2" &&
    ++	test_expect_success "value for $title is not printed" '
    ++		test_must_fail git config "$key" >out 2>err &&
     +		test_must_be_empty out &&
     +		test_must_be_empty err
    -+	"
    ++	'
     +}
     +
     +test_missing_key 'missingsection.missingkey' 'missing section and missing key'
     +test_missing_key 'missingsection.penguin' 'missing section and existing key'
     +test_missing_key 'section.missingkey' 'existing section and missing key'
    ++test_missing_key 'section.MissingSubSection.missingkey' 'missing subsection and missing key'
    ++test_missing_key 'section.SubSection.missingkey' 'existing subsection and missing key'
    ++test_missing_key 'section.MissingSubSection.key' 'missing subsection and existing key'
     +
      cat > .git/config <<\EOF
      [alpha]

Comments

Junio C Hamano May 1, 2023, 10:02 p.m. UTC | #1
Andrei Rybak <rybak.a.v@gmail.com> writes:

> Clean up existing tests and add new tests in t1300-config.sh.
>
> v1 cover letter:
>   https://lore.kernel.org/git/20230414081352.810296-1-rybak.a.v@gmail.com/
> v2 cover letter:
>   https://lore.kernel.org/git/20230418175034.982433-1-rybak.a.v@gmail.com/

This hasn't seen any further reactions.  Is everybody happy to see
us declare victory and merge it down to 'next'?

Thanks.
Andrei Rybak May 2, 2023, 7:58 p.m. UTC | #2
On 02/05/2023 00:02, Junio C Hamano wrote:
> Andrei Rybak <rybak.a.v@gmail.com> writes:
> 
>> Clean up existing tests and add new tests in t1300-config.sh.
>>
>> v1 cover letter:
>>    https://lore.kernel.org/git/20230414081352.810296-1-rybak.a.v@gmail.com/
>> v2 cover letter:
>>    https://lore.kernel.org/git/20230418175034.982433-1-rybak.a.v@gmail.com/
> 
> This hasn't seen any further reactions.  Is everybody happy to see
> us declare victory and merge it down to 'next'?

I'm happy with this series, especially because new tests in patch 3/3 indirectly
address some of the concerns for unused files removal in t1300 in the original
series of this thread, "t: fix unused files, part 2".

   https://lore.kernel.org/git/230406.86pm8htnfk.gmgdl@evledraar.gmail.com/

> Thanks.