git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Ben Peart <peartben@gmail.com>
To: "Torsten Bögershausen" <tboegi@web.de>,
	"Ben Peart" <benpeart@microsoft.com>
Cc: git@vger.kernel.org, prohaska@zib.de, gitster@pobox.com,
	sunshine@sunshineco.com, novalis@novalis.org
Subject: Re: [PATCH v1] name-hash: properly fold directory names in adjust_dirname_case()
Date: Thu, 8 Feb 2018 12:45:13 -0500	[thread overview]
Message-ID: <8a6b704f-409d-9a29-2229-d792d0f503ae@gmail.com> (raw)
In-Reply-To: <20180208172153.GA30760@tor.lan>



On 2/8/2018 12:21 PM, Torsten Bögershausen wrote:
> On Wed, Feb 07, 2018 at 07:41:56PM -0500, Ben Peart wrote:
> []
> 
>> diff --git a/t/t0050-filesystem.sh b/t/t0050-filesystem.sh
>> index b29d749bb7..219c96594c 100755
>> --- a/t/t0050-filesystem.sh
>> +++ b/t/t0050-filesystem.sh
>> @@ -80,7 +80,17 @@ test_expect_success 'merge (case change)' '
>>   	git merge topic
>>   '
>>   
>> -
>> +test_expect_success CASE_INSENSITIVE_FS 'add directory (with different case)' '
>> +	git reset --hard initial &&
>> +	mkdir -p dir1 &&
>> +	mkdir -p dir1/dir2 &&
>> +	touch dir1/dir2/a &&
>> +	touch dir1/dir2/b &&
>> +	git add dir1/dir2/a &&
>> +	git add dir1/DIR2/b &&
>> +	camel=$(git ls-files | grep dir2) &&
>> +	test $(echo "$camel" | wc -l) = 2
>> +'
>>   
> 
> There is nothing wrong with with "wc -l", but:
> a more new-style would probably use test_line_count() here.
> 
> My personal favorite would be to spell out what we expect and run a diff.
> When it fails, we can see what fails, and the function would look
> like this:
> 

I agree with you completely that this is a better format and is easier 
to read.  All the new tests I've been writing follow this same pattern.

In this particular test file, I opted (for better and for worse) to 
stick with the style of all the other tests rather than 1) have this one 
test be very different than all the others or 2) rewriting all the 
existing tests in the new style.

> 
> test_expect_success CASE_INSENSITIVE_FS 'add directory (with different case)' '
> 	git reset --hard initial &&
> 	mkdir -p dir1 &&
> 	mkdir -p dir1/dir2 &&
> 	touch dir1/dir2/a &&
> 	touch dir1/dir2/b &&
> 	git add dir1/dir2/a &&
> 	git add dir1/DIR2/b &&
> 	git ls-files | grep dir2 | sort >actual &&
> 	cat >expected <<-\EOF &&
> 	dir1/dir2/a
> 	dir1/dir2/b
> 	EOF
> 	test_cmp expected actual
> '
> 
> 
> 

  reply	other threads:[~2018-02-08 17:45 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-08  0:41 [PATCH v1] name-hash: properly fold directory names in adjust_dirname_case() Ben Peart
2018-02-08  1:02 ` David Turner
2018-02-08 17:21 ` Torsten Bögershausen
2018-02-08 17:45   ` Ben Peart [this message]
2018-02-08 18:24   ` Junio C Hamano
2018-02-08 18:20 ` Junio C Hamano
2018-02-08 19:23 ` [PATCH v2] " Ben Peart
2018-02-09  5:43   ` Torsten Bögershausen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=8a6b704f-409d-9a29-2229-d792d0f503ae@gmail.com \
    --to=peartben@gmail.com \
    --cc=benpeart@microsoft.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=novalis@novalis.org \
    --cc=prohaska@zib.de \
    --cc=sunshine@sunshineco.com \
    --cc=tboegi@web.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).