Re: t6023 broken under Mac OS

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




On 01/01/16 17:49, Torsten Bögershausen wrote:
> On 2016-01-01 18.14, Ramsay Jones wrote:
>> Hi Torsten,
>>
>> On 01/01/16 15:36, Torsten Bögershausen wrote:
>>> The (last) test case
>>> 'conflict markers contain CRLF when core.eol=crlf'
>>>
>>> does not work as expected under Mac OS: "wc -l" is not portable and the line
>>> test $(sed -n "/\.txt\r$/p" output.txt | wc -l) = 3
>>> fails.
>>
>> Hmm, I have never used a Mac, so I'm just guessing here, but
>> you could try something like (obviously untested!):
>>
>> diff --git a/t/t6023-merge-file.sh b/t/t6023-merge-file.sh
>> index 245359a..68b306f 100755
>> --- a/t/t6023-merge-file.sh
>> +++ b/t/t6023-merge-file.sh
>> @@ -350,7 +350,7 @@ test_expect_success 'conflict at EOF without LF resolved by --union' \
>>  test_expect_success 'conflict markers contain CRLF when core.eol=crlf' '
>>  	test_must_fail git -c core.eol=crlf merge-file -p \
>>  		nolf-diff1.txt nolf-orig.txt nolf-diff2.txt >output.txt &&
>> -	test $(sed -n "/\.txt\r$/p" output.txt | wc -l) = 3
>> +	test $(tr "\015" Q <output.txt | sed -n "/\.txtQ$/p" | wc -l) -eq 3
>>  '
>>  
>>  test_done
> Yes, this works.
> 
>>
>> [The 'wc -l' portability should only be a problem if you rely on the
>> exact textual form of the output, rather than the integer count.
>> 'wc -l' is used in many many tests ...]
>>
>> Note that this test is not checking all conflict markers (the
>> ======= marker does not have a filename appended). Should that
>> be fixed also?
> This is may attempt (against pu)
> 
> diff --git a/t/t6023-merge-file.sh b/t/t6023-merge-file.sh
> index 68b306f..b1f8e41 100755
> --- a/t/t6023-merge-file.sh
> +++ b/t/t6023-merge-file.sh
> @@ -350,7 +350,13 @@ test_expect_success 'conflict at EOF without LF resolved by
> --union' \
>  test_expect_success 'conflict markers contain CRLF when core.eol=crlf' '
>         test_must_fail git -c core.eol=crlf merge-file -p \
>                 nolf-diff1.txt nolf-orig.txt nolf-diff2.txt >output.txt &&
> -       test $(tr "\015" Q <output.txt | sed -n "/\.txtQ$/p" | wc -l) -eq 3
> +       tr "\015" Q <output.txt | sed -n "/\.txtQ$/p" >out &&
> +       cat >exp <<\EOF  &&
> +<<<<<<< nolf-diff1.txtQ
> +||||||| nolf-orig.txtQ
> +>>>>>>> nolf-diff2.txtQ
> +EOF
> +        test_cmp exp out
>  '
> 

This still doesn't test the '======= conflict marker', how about
something like this (again not tested on Mac - is the re in the
sed invocation OK on the Mac?):

diff --git a/t/t6023-merge-file.sh b/t/t6023-merge-file.sh
index 245359a..0697b22 100755
--- a/t/t6023-merge-file.sh
+++ b/t/t6023-merge-file.sh
@@ -350,7 +350,14 @@ test_expect_success 'conflict at EOF without LF resolved by --union' \
 test_expect_success 'conflict markers contain CRLF when core.eol=crlf' '
 	test_must_fail git -c core.eol=crlf merge-file -p \
 		nolf-diff1.txt nolf-orig.txt nolf-diff2.txt >output.txt &&
-	test $(sed -n "/\.txt\r$/p" output.txt | wc -l) = 3
+	tr "\015" Q <output.txt | sed -n "/^[<=>|].*Q$/p" >out.txt &&
+	cat >expect.txt <<-\EOF &&
+	<<<<<<< nolf-diff1.txtQ
+	||||||| nolf-orig.txtQ
+	=======Q
+	>>>>>>> nolf-diff2.txtQ
+	EOF
+	test_cmp expect.txt out.txt
 '
 
 test_done

ATB,
Ramsay Jones


--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]