[PATCH 2/8] t3206: add color test for range-diff --dual-color

2018-08-13 Thread Stefan Beller
The 'expect'ed outcome has been taken by running the 'range-diff | decode'.

Signed-off-by: Stefan Beller 
Signed-off-by: Junio C Hamano 
---
 t/t3206-range-diff.sh | 39 +++
 1 file changed, 39 insertions(+)

diff --git a/t/t3206-range-diff.sh b/t/t3206-range-diff.sh
index 2237c7f4af9..31f6458f961 100755
--- a/t/t3206-range-diff.sh
+++ b/t/t3206-range-diff.sh
@@ -142,4 +142,43 @@ test_expect_success 'changed message' '
test_cmp expected actual
 '
 
+test_expect_success 'dual-coloring' '
+   sed -e "s|^:||" >expect <<-\EOF &&
+   :1:  a4b = 1:  f686024 s/5/A/
+   :2:  f51d370 ! 2:  
4ab067d s/4/A/
+   :@@ -2,6 +2,8 @@
+   : 
+   : s/4/A/
+   : 
+   :+Also a silly comment here!
+   :+
+   : diff --git a/file b/file
+   : --- a/file
+   : +++ b/file
+   :3:  0559556 ! 3:  
b9cb956 s/11/B/
+   :@@ -10,7 +10,7 @@
+   :  9
+   :  10
+   : -11
+   :-+BB
+   :++B
+   :  12
+   :  13
+   :  14
+   :4:  d966c5c ! 4:  
8add5f1 s/12/B/
+   :@@ -8,7 +8,7 @@
+   : @@
+   :  9
+   :  10
+   :- BB
+   :+ B
+   : -12
+   : +B
+   :  13
+   EOF
+   git range-diff changed...changed-message --color --dual-color 
>actual.raw &&
+   test_decode_color >actual 

Re: [PATCH 2/8] t3206: add color test for range-diff --dual-color

2018-08-13 Thread Stefan Beller
On Mon, Aug 13, 2018 at 5:05 AM Johannes Schindelin
 wrote:
>
> Hi Stefan,
>
> On Fri, 10 Aug 2018, Stefan Beller wrote:
>
> > +test_expect_success 'dual-coloring' '
> > + sed -e "s|^:||" >expect <<-\EOF &&
> > + :1:  a4b = 1:  f686024 s/5/A/
> > + :2:  f51d370 ! 2:  
> > 4ab067d s/4/A/
> > + :@@ -2,6 +2,8 @@
>
> That's a neat trick to have an indented here-doc that contains
> indentation. I should use this myself.

Thanks to Junio for applying this trick!


Re: [PATCH 2/8] t3206: add color test for range-diff --dual-color

2018-08-13 Thread Johannes Schindelin
Hi Stefan,

On Fri, 10 Aug 2018, Stefan Beller wrote:

> +test_expect_success 'dual-coloring' '
> + sed -e "s|^:||" >expect <<-\EOF &&
> + :1:  a4b = 1:  f686024 s/5/A/
> + :2:  f51d370 ! 2:  
> 4ab067d s/4/A/
> + :@@ -2,6 +2,8 @@

That's a neat trick to have an indented here-doc that contains
indentation. I should use this myself.

The rest of the diff looks good, too, thanks!
Dscho

> + : 
> + : s/4/A/
> + : 
> + :+Also a silly comment here!
> + :+
> + : diff --git a/file b/file
> + : --- a/file
> + : +++ b/file
> + :3:  0559556 ! 3:  
> b9cb956 s/11/B/
> + :@@ -10,7 +10,7 @@
> + :  9
> + :  10
> + : -11
> + :-+BB
> + :++B
> + :  12
> + :  13
> + :  14
> + :4:  d966c5c ! 4:  
> 8add5f1 s/12/B/
> + :@@ -8,7 +8,7 @@
> + : @@
> + :  9
> + :  10
> + :- BB
> + :+ B
> + : -12
> + : +B
> + :  13
> + EOF
> + git range-diff changed...changed-message --color --dual-color 
> >actual.raw &&
> + test_decode_color >actual  + test_cmp expect actual
> +'
> +
>  test_done
> -- 
> 2.18.0.865.gffc8e1a3cd6-goog
> 
> 


[PATCH 2/8] t3206: add color test for range-diff --dual-color

2018-08-10 Thread Stefan Beller
The 'expect'ed outcome has been taken by running the 'range-diff | decode'.

Signed-off-by: Stefan Beller 
Signed-off-by: Junio C Hamano 
---
 t/t3206-range-diff.sh | 39 +++
 1 file changed, 39 insertions(+)

diff --git a/t/t3206-range-diff.sh b/t/t3206-range-diff.sh
index 2237c7f4af9..7dc7c80a1de 100755
--- a/t/t3206-range-diff.sh
+++ b/t/t3206-range-diff.sh
@@ -142,4 +142,43 @@ test_expect_success 'changed message' '
test_cmp expected actual
 '
 
+test_expect_success 'dual-coloring' '
+   sed -e "s|^:||" >expect <<-\EOF &&
+   :1:  a4b = 1:  f686024 s/5/A/
+   :2:  f51d370 ! 2:  
4ab067d s/4/A/
+   :@@ -2,6 +2,8 @@
+   : 
+   : s/4/A/
+   : 
+   :+Also a silly comment here!
+   :+
+   : diff --git a/file b/file
+   : --- a/file
+   : +++ b/file
+   :3:  0559556 ! 3:  
b9cb956 s/11/B/
+   :@@ -10,7 +10,7 @@
+   :  9
+   :  10
+   : -11
+   :-+BB
+   :++B
+   :  12
+   :  13
+   :  14
+   :4:  d966c5c ! 4:  
8add5f1 s/12/B/
+   :@@ -8,7 +8,7 @@
+   : @@
+   :  9
+   :  10
+   :- BB
+   :+ B
+   : -12
+   : +B
+   :  13
+   EOF
+   git range-diff changed...changed-message --color --dual-color 
>actual.raw &&
+   test_decode_color >actual 

Re: [PATCH 2/8] t3206: add color test for range-diff --dual-color

2018-07-31 Thread Junio C Hamano
Stefan Beller  writes:

> The 'expect'ed outcome has been taken by running the 'range-diff | decode'.
>
> Signed-off-by: Stefan Beller 
> ---
>  t/t3206-range-diff.sh | 39 +++
>  1 file changed, 39 insertions(+)
>
> diff --git a/t/t3206-range-diff.sh b/t/t3206-range-diff.sh
> index 2237c7f4af9..019724e61a0 100755
> --- a/t/t3206-range-diff.sh
> +++ b/t/t3206-range-diff.sh
> @@ -142,4 +142,43 @@ test_expect_success 'changed message' '
>   test_cmp expected actual
>  '
>  
> +test_expect_success 'dual-coloring' '
> + cat >expect <<-\EOF &&

It is a good idea to use something like "sed -e 's/^|//'" instead of
"cat" here; that way allows you to mark the left-edge of the data
with "|", for a test vector like this one that has a line that would
otherwise violate the whitespace style rules.  

An inferiour alternative would be to add .gitaddtibute entry to make
this file exempt from indent-with-tab rule, but even in this 40-line
block there only is one line that requires such a workaround, and it
won't help the initial application of this patch to get modified
when applied with "am --whitespace=fix".

> + 1:  a4b = 1:  f686024 s/5/A/
> + 2:  f51d370 ! 2:  
> 4ab067d s/4/A/
> + @@ -2,6 +2,8 @@
> +  
> +  s/4/A/
> +  
> + +Also a silly comment here!
> + +
> +  diff --git a/file b/file
> +  --- a/file
> +  +++ b/file
> + 3:  0559556 ! 3:  
> b9cb956 s/11/B/
> + @@ -10,7 +10,7 @@
> +   9
> +   10
> +  -11
> + -+BB
> + ++B
> +   12
> +   13
> +   14
> + 4:  d966c5c ! 4:  
> 8add5f1 s/12/B/
> + @@ -8,7 +8,7 @@
> +  @@
> +   9
> +   10
> + - BB
> + + B
> +  -12
> +  +B
> +   13
> + EOF
> + git range-diff changed...changed-message --color --dual-color 
> >actual.raw &&
> + test_decode_color >actual  + test_cmp expect actual
> +'
> +
>  test_done


[PATCH 2/8] t3206: add color test for range-diff --dual-color

2018-07-30 Thread Stefan Beller
The 'expect'ed outcome has been taken by running the 'range-diff | decode'.

Signed-off-by: Stefan Beller 
---
 t/t3206-range-diff.sh | 39 +++
 1 file changed, 39 insertions(+)

diff --git a/t/t3206-range-diff.sh b/t/t3206-range-diff.sh
index 2237c7f4af9..019724e61a0 100755
--- a/t/t3206-range-diff.sh
+++ b/t/t3206-range-diff.sh
@@ -142,4 +142,43 @@ test_expect_success 'changed message' '
test_cmp expected actual
 '
 
+test_expect_success 'dual-coloring' '
+   cat >expect <<-\EOF &&
+   1:  a4b = 1:  f686024 s/5/A/
+   2:  f51d370 ! 2:  
4ab067d s/4/A/
+   @@ -2,6 +2,8 @@
+
+s/4/A/
+
+   +Also a silly comment here!
+   +
+diff --git a/file b/file
+--- a/file
++++ b/file
+   3:  0559556 ! 3:  
b9cb956 s/11/B/
+   @@ -10,7 +10,7 @@
+ 9
+ 10
+-11
+   -+BB
+   ++B
+ 12
+ 13
+ 14
+   4:  d966c5c ! 4:  
8add5f1 s/12/B/
+   @@ -8,7 +8,7 @@
+@@
+ 9
+ 10
+   - BB
+   + B
+-12
++B
+ 13
+   EOF
+   git range-diff changed...changed-message --color --dual-color 
>actual.raw &&
+   test_decode_color >actual 

Re: [PATCH 2/8] t3206: add color test for range-diff --dual-color

2018-07-30 Thread Stefan Beller
On Fri, Jul 27, 2018 at 11:28 PM Eric Sunshine  wrote:
>
> On Fri, Jul 27, 2018 at 11:05 PM Stefan Beller  wrote:
> > The 'expect'ed outcome is taken by running the 'range-diff |decode';
> > it is not meant as guidance, rather as a documentation of the current
> > situation.
>
> I'm not really sure what this is trying to say. It seems _too_ brief.
>
> Did you want a space after the vertical bar before "decode"?

I am trying to say that this patch was generated by inserting
a "true && test_pause" first and then inside that paused test,
I just run

  source /t/test-lib-functions.sh
  git range-diff changed...changed-message --color --dual-color \
| test_decode_color

and saved that as the expected outcome, I was prepared to
massage it gently by s//Q/ but that was not needed,
but I forgot the q_to_tab in place.

By adding the test this way, I just want to state "I observed
the functionality as produced in this patch". I do not want
to endorse the coloring scheme or claim it is good (it is,
but I also still have nits to pick). So I tried to briefly say
that the test is essentially "autogenerated" by just observing
output at that point in time.

>
> > Signed-off-by: Stefan Beller 
> > ---
> > diff --git a/t/t3206-range-diff.sh b/t/t3206-range-diff.sh
> > +test_expect_success 'simple coloring' '
> > +   q_to_tab >expect <<-EOF &&
>
> Why 'q_to_tab'? I don't see any "q"'s in the body.
>
> I also don't see any variable interpolation in the body, so maybe you
> want -\EOF instead?

All good suggestions! Thanks for the review, I'll incorporate them.

Thanks,
Stefan


Re: [PATCH 2/8] t3206: add color test for range-diff --dual-color

2018-07-28 Thread Eric Sunshine
On Fri, Jul 27, 2018 at 11:05 PM Stefan Beller  wrote:
> The 'expect'ed outcome is taken by running the 'range-diff |decode';
> it is not meant as guidance, rather as a documentation of the current
> situation.

I'm not really sure what this is trying to say. It seems _too_ brief.

Did you want a space after the vertical bar before "decode"?

> Signed-off-by: Stefan Beller 
> ---
> diff --git a/t/t3206-range-diff.sh b/t/t3206-range-diff.sh
> +test_expect_success 'simple coloring' '
> +   q_to_tab >expect <<-EOF &&

Why 'q_to_tab'? I don't see any "q"'s in the body.

I also don't see any variable interpolation in the body, so maybe you
want -\EOF instead?


[PATCH 2/8] t3206: add color test for range-diff --dual-color

2018-07-27 Thread Stefan Beller
The 'expect'ed outcome is taken by running the 'range-diff |decode';
it is not meant as guidance, rather as a documentation of the current
situation.

Signed-off-by: Stefan Beller 
---
 t/t3206-range-diff.sh | 39 +++
 1 file changed, 39 insertions(+)

diff --git a/t/t3206-range-diff.sh b/t/t3206-range-diff.sh
index 2237c7f4af9..ef652865cd7 100755
--- a/t/t3206-range-diff.sh
+++ b/t/t3206-range-diff.sh
@@ -142,4 +142,43 @@ test_expect_success 'changed message' '
test_cmp expected actual
 '
 
+test_expect_success 'simple coloring' '
+   q_to_tab >expect <<-EOF &&
+   1:  a4b = 1:  f686024 s/5/A/
+   2:  f51d370 ! 2:  
4ab067d s/4/A/
+   @@ -2,6 +2,8 @@
+
+s/4/A/
+
+   +Also a silly comment here!
+   +
+diff --git a/file b/file
+--- a/file
++++ b/file
+   3:  0559556 ! 3:  
b9cb956 s/11/B/
+   @@ -10,7 +10,7 @@
+ 9
+ 10
+-11
+   -+BB
+   ++B
+ 12
+ 13
+ 14
+   4:  d966c5c ! 4:  
8add5f1 s/12/B/
+   @@ -8,7 +8,7 @@
+@@
+ 9
+ 10
+   - BB
+   + B
+-12
++B
+ 13
+   EOF
+   git range-diff changed...changed-message --color --dual-color 
>actual.raw &&
+   test_decode_color >actual