Thread (4 messages) flat view 4 messages, 4 authors, 2016-06-15

Re: [PATCH] t6022: Use -eq not = to test output of wc -l

From: Johannes Sixt <hidden>
Date: 2016-06-15 22:50:03

Possibly related (same subject, not in this thread)

Am 11/15/2010 23:21, schrieb Junio C Hamano:
Brian Gernhardt [off-list ref] writes:
quoted
When comparing numbers such as "3" to "$(wc -l)", we should check for
numerical equality using -eq instead of string equality using = because
some implementations of wc output extra whitespace.

Signed-off-by: Brian Gernhardt <redacted>
---
 The alternative would be to use 3 = $(wc -l) (sans quotes), but other parts
 of the test used the -eq method.
... which looks a tad ugly.

How about doing something like below after merging Jonathan's fb3340a
(test-lib: introduce test_line_count to measure files, 2010-10-31) instead?

-- >8 --
test_line_count: learn how to read from a pipe
I don't think that any of this (neither Jonathan's nor yours) has any benefit:

- The result is not easier to read.

- Nor are the lines of shell code shorter.

- If something in the pipe requires quoting, you need an extra level of
quotes.

- It doesn't save any messages or fix-ups during review: instead of "do
not quote!" we have to say "use test_line_count!".

Just my opinion.

-- Hannes
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help