Re: [PATCH v9 2/5] t4205: revert back single quotes

2013-07-05 Thread Junio C Hamano
Alexey Shumkin  writes:

> In previuos commit de6029a2d7734a93a9e27b9c4471862a47dd8123 single
> quotes were replaced with double quotes to make "$(commit_msg)"
> expression in heredoc to work. The same effect can be achieved by using
> "EOF" as a heredoc delimiter instead of "\EOF".

OK.

> -test_expect_success 'left alignment formatting' "
> - git log --pretty='format:%<(40)%s' >actual &&
> +test_expect_success 'left alignment formatting' '
> + git log --pretty="format:%<(40)%s" >actual &&
>   # complete the incomplete line at the end
>   echo >>actual &&
> - qz_to_tab_space <<\EOF >expected &&
> + qz_to_tab_space   message twoZ
>  message oneZ
>  add barZ
>  $(commit_msg)Z
>  EOF
>   test_cmp expected actual
> -"
> +'

A subtle difference is that a call to commit_msg is made when the
test is actually run, not when the test script is prepared to be
passed (as a parameter) to test_expect_success helper.  I think the
result of applying this patch, i.e. running $(commit_msg) inside the
test, is easier to read and understand.
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v9 2/5] t4205: revert back single quotes

2013-07-04 Thread Alexey Shumkin
In previuos commit de6029a2d7734a93a9e27b9c4471862a47dd8123 single
quotes were replaced with double quotes to make "$(commit_msg)"
expression in heredoc to work. The same effect can be achieved by using
"EOF" as a heredoc delimiter instead of "\EOF".

Signed-off-by: Alexey Shumkin 
Suggested-by: Johannes Sixt 
---
 t/t4205-log-pretty-formats.sh | 106 +-
 1 file changed, 53 insertions(+), 53 deletions(-)

diff --git a/t/t4205-log-pretty-formats.sh b/t/t4205-log-pretty-formats.sh
index c283842..ef9770a 100755
--- a/t/t4205-log-pretty-formats.sh
+++ b/t/t4205-log-pretty-formats.sh
@@ -145,174 +145,174 @@ test_expect_success 'setup more commits' '
head4=$(git rev-parse --verify --short HEAD~3)
 '
 
-test_expect_success 'left alignment formatting' "
-   git log --pretty='format:%<(40)%s' >actual &&
+test_expect_success 'left alignment formatting' '
+   git log --pretty="format:%<(40)%s" >actual &&
# complete the incomplete line at the end
echo >>actual &&
-   qz_to_tab_space <<\EOF >expected &&
+   qz_to_tab_space actual &&
+test_expect_success 'left alignment formatting at the nth column' '
+   git log --pretty="format:%h %<|(40)%s" >actual &&
# complete the incomplete line at the end
echo >>actual &&
-   qz_to_tab_space <<\EOF >expected &&
+   qz_to_tab_space actual &&
+test_expect_success 'left alignment formatting with no padding' '
+   git log --pretty="format:%<(1)%s" >actual &&
# complete the incomplete line at the end
echo >>actual &&
-   cat <<\EOF >expected &&
+   cat actual &&
+test_expect_success 'left alignment formatting with trunc' '
+   git log --pretty="format:%<(10,trunc)%s" >actual &&
# complete the incomplete line at the end
echo >>actual &&
-   qz_to_tab_space <<\EOF >expected &&
+   qz_to_tab_space actual &&
+test_expect_success 'left alignment formatting with ltrunc' '
+   git log --pretty="format:%<(10,ltrunc)%s" >actual &&
# complete the incomplete line at the end
echo >>actual &&
-   qz_to_tab_space <<\EOF >expected &&
+   qz_to_tab_space actual &&
+test_expect_success 'left alignment formatting with mtrunc' '
+   git log --pretty="format:%<(10,mtrunc)%s" >actual &&
# complete the incomplete line at the end
echo >>actual &&
-   qz_to_tab_space <<\EOF >expected &&
+   qz_to_tab_space actual &&
+test_expect_success 'right alignment formatting' '
+   git log --pretty="format:%>(40)%s" >actual &&
# complete the incomplete line at the end
echo >>actual &&
-   qz_to_tab_space <<\EOF >expected &&
+   qz_to_tab_space actual &&
+test_expect_success 'right alignment formatting at the nth column' '
+   git log --pretty="format:%h %>|(40)%s" >actual &&
# complete the incomplete line at the end
echo >>actual &&
-   qz_to_tab_space <<\EOF >expected &&
+   qz_to_tab_space