diff tests/test-diff-color.t @ 22460:c343557a8442

patch: enable diff.tab markup for the color extension The following patch splits up changed lines along tabs (using re.findall), and gives them a "diff.tab" label. This can be used by the color extension for colorising tabs, like it does right now with trailing whitespace. I also provide corresponding tests.
author Jordi Guti?rrez Hermoso <jordigh@octave.org>
date Wed, 20 Aug 2014 15:15:50 -0400
parents 0ade08dcb3c3
children 9ab18a912c44
line wrap: on
line diff
--- a/tests/test-diff-color.t	Wed Sep 17 13:08:03 2014 -0700
+++ b/tests/test-diff-color.t	Wed Aug 20 15:15:50 2014 -0400
@@ -159,4 +159,44 @@
    b
   \x1b[0;32m+bb\x1b[0m (esc)
 
+test tabs
+
+  $ cat >> a <<EOF
+  > 	one tab
+  > 		two tabs
+  > end tab	
+  > mid	tab
+  > 	all		tabs	
+  > EOF
+  $ hg diff --nodates --color=always
+  \x1b[0;1mdiff --git a/a b/a\x1b[0m (esc)
+  \x1b[0;31;1m--- a/a\x1b[0m (esc)
+  \x1b[0;32;1m+++ b/a\x1b[0m (esc)
+  \x1b[0;35m@@ -7,3 +7,9 @@\x1b[0m (esc)
+   a
+   c
+   c
+  \x1b[0;32m+aa\x1b[0m (esc)
+  \x1b[0;32m+\x1b[0m	\x1b[0;32mone tab\x1b[0m (esc)
+  \x1b[0;32m+\x1b[0m		\x1b[0;32mtwo tabs\x1b[0m (esc)
+  \x1b[0;32m+end tab\x1b[0m\x1b[0;1;41m	\x1b[0m (esc)
+  \x1b[0;32m+mid\x1b[0m	\x1b[0;32mtab\x1b[0m (esc)
+  \x1b[0;32m+\x1b[0m	\x1b[0;32mall\x1b[0m		\x1b[0;32mtabs\x1b[0m\x1b[0;1;41m	\x1b[0m (esc)
+  $ echo "[color]" >> $HGRCPATH
+  $ echo "diff.tab = bold magenta" >> $HGRCPATH
+  $ hg diff --nodates --color=always
+  \x1b[0;1mdiff --git a/a b/a\x1b[0m (esc)
+  \x1b[0;31;1m--- a/a\x1b[0m (esc)
+  \x1b[0;32;1m+++ b/a\x1b[0m (esc)
+  \x1b[0;35m@@ -7,3 +7,9 @@\x1b[0m (esc)
+   a
+   c
+   c
+  \x1b[0;32m+aa\x1b[0m (esc)
+  \x1b[0;32m+\x1b[0m\x1b[0;1;35m	\x1b[0m\x1b[0;32mone tab\x1b[0m (esc)
+  \x1b[0;32m+\x1b[0m\x1b[0;1;35m		\x1b[0m\x1b[0;32mtwo tabs\x1b[0m (esc)
+  \x1b[0;32m+end tab\x1b[0m\x1b[0;1;41m	\x1b[0m (esc)
+  \x1b[0;32m+mid\x1b[0m\x1b[0;1;35m	\x1b[0m\x1b[0;32mtab\x1b[0m (esc)
+  \x1b[0;32m+\x1b[0m\x1b[0;1;35m	\x1b[0m\x1b[0;32mall\x1b[0m\x1b[0;1;35m		\x1b[0m\x1b[0;32mtabs\x1b[0m\x1b[0;1;41m	\x1b[0m (esc)
+
   $ cd ..