diff tests/test-grep.t @ 29854:b842b1adfea2

grep: refactor loop that yields matched text with label As preparation for formatter support, this and the next patch split linestate.__iter__() into two functions, line scanner and displayer. New code uses regexp.search(str, pos) in place of regexp.search(substr), which appears to fix a bug of highlighting.
author Yuya Nishihara <yuya@tcha.org>
date Thu, 18 Aug 2016 14:03:25 +0900
parents c260887cdbcd
children 33461139c31c
line wrap: on
line diff
--- a/tests/test-grep.t	Tue Jul 05 09:37:07 2016 +0200
+++ b/tests/test-grep.t	Thu Aug 18 14:03:25 2016 +0900
@@ -111,6 +111,12 @@
   color:2:-:orange
   color:1:+:orange
 
+test substring match: '^' should only match at the beginning
+
+  $ hg grep '^.' --config extensions.color= --color debug
+  [grep.filename|color][grep.sep|:][grep.rev|3][grep.sep|:][grep.match|b]lack
+  [grep.filename|color][grep.sep|:][grep.rev|3][grep.sep|:][grep.match|o]range
+  [grep.filename|color][grep.sep|:][grep.rev|3][grep.sep|:][grep.match|b]lue
 
 match in last "line" without newline