While the condition in mentioned guard was false for all tests run via
"make check", I constructed a case for which the if-block is actually
required. I'll add an actual test after the upcoming release.
From a69f71feaaf67d519f7ee75545ee73c1eb1843a5 Mon Sep 17 00:00:00 2001
From: Jim Meyering <[email protected]>
Date: Mon, 23 Dec 2013 12:33:12 -0800
Subject: [PATCH] maint: fix/improve a comment
* src/main.c (prline): Replace untrue FIXME comment with one
telling how the hard-to-reach code can be exercised.
---
src/main.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/src/main.c b/src/main.c
index 1dfbcb6..a7487df 100644
--- a/src/main.c
+++ b/src/main.c
@@ -937,9 +937,12 @@ prline (char const *beg, char const *lim, int sep)
if (matching && (only_matching || *match_color))
beg = print_line_middle (beg, lim, line_color, match_color);
- /* FIXME: this test may be removable. */
if (!only_matching && *line_color)
- beg = print_line_tail (beg, lim, line_color);
+ {
+ /* This code is exercised at least when grep is invoked like this:
+ echo k| GREP_COLORS='sl=01;32' src/grep k --color=always */
+ beg = print_line_tail (beg, lim, line_color);
+ }
}
if (!only_matching && lim > beg)
--
1.8.5.rc2.6.gc6f1b92