Re: [PATCH v2 11/27] blame tests: simplify userdiff driver test

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Ævar Arnfjörð Bjarmason <avarab@xxxxxxxxx> writes:

>>> +	fortran_file=file.f03 &&
>>> +	test_when_finished "rm .gitattributes" &&
>>> +	echo "$fortran_file diff=fortran" >.gitattributes &&
>>> +
>>> +	test_commit --author "A <A@xxxxxxxx>" \
>>> +		"add" $fortran_file \
>>> +		"$(cat file.template)" &&
>>> +	test_commit --author "B <B@xxxxxxxx>" \
>>> +		"change" $fortran_file \
>>> +		"$(cat file.template | sed -e s/ChangeMe/IWasChanged/)" &&
>>> +	check_count -f $fortran_file -L:RIGHT A 3 B 1
> ...
>> Please place "$fortran_file" in dquotes on the check_count line.
>
> Why do we need to dquote a convenience variable defined in the test
> itself that'll never contain spaces or other funny things we'd get if we
> had $(pwd) or whatever in there? It wouldn't hurt, but maybe I'm missing
> some reason for why it's necessary or desired here.

Always dquoting when the code does not depend on splitting at IFS
whitespace reduces cognitive load.  The person who looks at the
variable reference, $fortran_file, has to wonder if the unquoted
form is used to take advantage of being split at IFS whitespaces, or
the test author saved two keystrokes because the filename does not
have any such whitespace, and go back to the assignment to check.





[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux