t9101: Refactor test_expect_success format
PATCH 1/1 t9101: Refactor test_expect_success format
The current script uses an outdated formatting style for test_expect_success blocks, where each argument is separated by a backslash and newline. This style can lead to readability issues and makes it harder to maintain the script.
The modern style consolidates
the multi-line command arguments into a single quoted block, which improves readability, maintainability, and aligns the code with current coding standards.
--- t/t9101-git-svn-props.sh | 48 ++++++++++++++++++++++------------------ 1 file changed, 26 insertions(+), 22 deletions(-)
t/t9101-git-svn-props.sh +26 -22
@@ -73,12 +73,13 @@ test_expect_success 'initialize git svn' 'git svn init "$svnrepo"' test_expect_success 'fetch revisions from svn' 'git svn fetch' name='test svn:keywords ignoring' -test_expect_success "$name" \ - 'git checkout -b mybranch remotes/git-svn && +test_expect_success "$name" ' + git checkout -b mybranch remotes/git-svn && echo Hi again >>kw.c && git commit -a -m "test keywords ignoring" && git svn set-tree remotes/git-svn..mybranch && - git pull . remotes/git-svn' + git pull . remotes/git-svn +' expect='/* $Id$ */' got="$(sed -ne 2p kw.c)"
@@ -94,10 +95,11 @@ test_expect_success "propset CR on crlf files" ' ) ' -test_expect_success 'fetch and pull latest from svn and checkout a new wc' \ - 'git svn fetch && - git pull . remotes/git-svn && - svn_cmd co "$svnrepo" new_wc' +test_expect_success 'fetch and pull latest from svn and checkout a new wc' ' + git svn fetch && + git pull . remotes/git-svn && + svn_cmd co "$svnrepo" new_wc +' for i in crlf ne_crlf lf ne_lf cr ne_cr empty_cr empty_lf empty empty_crlf do
@@ -110,15 +112,17 @@ cd test_wc printf '$Id$\rHello\rWorld' >ne_cr a_cr=$(printf '$Id$\r\nHello\r\nWorld\r\n' | git hash-object --stdin) a_ne_cr=$(printf '$Id$\r\nHello\r\nWorld' | git hash-object --stdin) - test_expect_success 'Set CRLF on cr files' \ - 'svn_cmd propset svn:eol-style CRLF cr && - svn_cmd propset svn:eol-style CRLF ne_cr && - svn_cmd propset svn:keywords Id cr && - svn_cmd propset svn:keywords Id ne_cr && - svn_cmd commit -m "propset CRLF on cr files"' + test_expect_success 'Set CRLF on cr files' ' + svn_cmd propset svn:eol-style CRLF cr && + svn_cmd propset svn:eol-style CRLF ne_cr && + svn_cmd propset svn:keywords Id cr && + svn_cmd propset svn:keywords Id ne_cr && + svn_cmd commit -m "propset CRLF on cr files" + ' cd .. -test_expect_success 'fetch and pull latest from svn' \ - 'git svn fetch && git pull . remotes/git-svn' +test_expect_success 'fetch and pull latest from svn' ' + git svn fetch && git pull . remotes/git-svn +' b_cr="$(git hash-object cr)" b_ne_cr="$(git hash-object ne_cr)"
@@ -141,7 +145,7 @@ cat >show-ignore.expect <<\EOF /deeply/nested/directory/no-such-file* EOF -test_expect_success 'test show-ignore' " +test_expect_success 'test show-ignore' ' ( cd test_wc && mkdir -p deeply/nested/directory &&
@@ -155,7 +159,7 @@ no-such-file* ) && git svn show-ignore >show-ignore.got && cmp show-ignore.expect show-ignore.got -" +' cat >create-ignore.expect <<\EOF /no-such-file*
@@ -170,7 +174,7 @@ cat >create-ignore-index.expect <<EOF 100644 $expectoid 0 deeply/nested/directory/.gitignore EOF -test_expect_success 'test create-ignore' " +test_expect_success 'test create-ignore' ' git svn fetch && git pull . remotes/git-svn && git svn create-ignore && cmp ./.gitignore create-ignore.expect &&
@@ -179,7 +183,7 @@ test_expect_success 'test create-ignore' " cmp ./deeply/nested/directory/.gitignore create-ignore.expect && git ls-files -s >ls_files_result && grep gitignore ls_files_result | cmp - create-ignore-index.expect - " +' cat >prop.expect <<\EOF
@@ -207,7 +211,7 @@ test_expect_success 'test propget' ' test_propget svn:ignore nested/ ../prop.expect && test_propget svn:ignore ./nested ../prop.expect && test_propget svn:ignore .././deeply/nested ../prop.expect - ' +' cat >prop.expect <<\EOF Properties on '.':
@@ -225,12 +229,12 @@ Properties on 'nested/directory/.keep': svn:entry:uuid EOF -test_expect_success 'test proplist' " +test_expect_success 'test proplist' ' git svn proplist . >actual && cmp prop.expect actual && git svn proplist nested/directory/.keep >actual && cmp prop2.expect actual - " +' test_done
Signature · 1 line
2.47.0.86.g15030f9556
Quoted 7 lines · Seyi Kuforiji
The current script uses an outdated formatting style for
test_expect_successblocks, where each argument is separated by a backslash and newline. This style can lead to readability issues and makes it harder to maintain the script.The modern style consolidates
the multi-line command arguments into a single quoted block, which
Strange line wrapping?
Quoted 7 lines
improves readability, maintainability, and aligns the code with current coding standards.
Signed-off-by Seyi Kuforiji <[email protected]>--- t/t9101-git-svn-props.sh | 48 ++++++++++++++++++++++------------------ 1 file changed, 26 insertions(+), 22 deletions(-)
This does not apply cleanly on 'master', so I assume that you wanted it based on sk/t9101-cleanup. That's fine, but please let me know in the future in case it's every less obvious :-).
The changes themselves all look quite sensible, though.
Thanks,
Taylor
Quoted 7 lines · Taylor Blau
Quoted 5 lines · Seyi Kuforiji
The current script uses an outdated formatting style for
test_expect_successblocks, where each argument is separated by a backslash and newline. This style can lead to readability issues and makes it harder to maintain the script.
Quoted 5 lines
Quoted 2 lines
The modern style consolidates
the multi-line command arguments into a single quoted block, whichStrange line wrapping?
That error probably occurred while I was editing the message. Should I edit and send an updated patch?
Quoted 8 lines
Quoted 7 lines
improves readability, maintainability, and aligns the code with current coding standards.
Signed-off-by Seyi Kuforiji <[email protected]>--- t/t9101-git-svn-props.sh | 48 ++++++++++++++++++++++------------------ 1 file changed, 26 insertions(+), 22 deletions(-)
Quoted 8 lines
This does not apply cleanly on 'master', so I assume that you wanted it based on sk/t9101-cleanup. That's fine, but please let me know in the future in case it's every less obvious :-).
The changes themselves all look quite sensible, though.
Thanks,
Taylor
Thanks, Taylor for pointing out this issue. I have rebased my change onto the latest master branch and resolved the conflicts for future updates.
Thanks,
Seyi
Quoted 8 lines · Seyi Chamber
Quoted 7 lines · Taylor Blau
Quoted 5 lines · Seyi Kuforiji
The current script uses an outdated formatting style for
test_expect_successblocks, where each argument is separated by a backslash and newline. This style can lead to readability issues and makes it harder to maintain the script.
Quoted 8 lines
Quoted 5 lines
Quoted 2 lines
The modern style consolidates
the multi-line command arguments into a single quoted block, whichStrange line wrapping?
That error probably occurred while I was editing the message. Should I edit and send an updated patch?
Please do so, thanks.
Quoted 12 lines
Quoted 12 lines
Quoted 7 lines
improves readability, maintainability, and aligns the code with current coding standards.
Signed-off-by Seyi Kuforiji <[email protected]>--- t/t9101-git-svn-props.sh | 48 ++++++++++++++++++++++------------------ 1 file changed, 26 insertions(+), 22 deletions(-)This does not apply cleanly on 'master', so I assume that you wanted it based on sk/t9101-cleanup. That's fine, but please let me know in the future in case it's every less obvious :-).
Quoted 8 lines
Quoted 4 lines
The changes themselves all look quite sensible, though.
Thanks,
TaylorThanks, Taylor for pointing out this issue. I have rebased my change onto the latest master branch and resolved the conflicts for future updates.
There is no specific need to rebase on top of current 'master' unless failing to do so will cause the maintainer to see a conflicted state when applying.
Unless told otherwise, I will apply new rounds of existing patch series onto top of their original base.
Thanks,
Taylor
PATCH v2 1/1 t9101: Refactor test_expect_success format
In reply to Seyi KuforijiThe current script uses an outdated formatting style for test_expect_success blocks, where each argument is separated by a backslash and newline. This style can lead to readability issues and makes it harder to maintain the script.The modern style consolidates the multi-line command arguments into a single quoted block, which improves readability, maintainability, and aligns the code with current coding standards.
--- t/t9101-git-svn-props.sh | 48 ++++++++++++++++++++++------------------ 1 file changed, 26 insertions(+), 22 deletions(-)
t/t9101-git-svn-props.sh +26 -22
@@ -73,12 +73,13 @@ test_expect_success 'initialize git svn' 'git svn init "$svnrepo"' test_expect_success 'fetch revisions from svn' 'git svn fetch' name='test svn:keywords ignoring' -test_expect_success "$name" \ - 'git checkout -b mybranch remotes/git-svn && +test_expect_success "$name" ' + git checkout -b mybranch remotes/git-svn && echo Hi again >>kw.c && git commit -a -m "test keywords ignoring" && git svn set-tree remotes/git-svn..mybranch && - git pull . remotes/git-svn' + git pull . remotes/git-svn +' expect='/* $Id$ */' got="$(sed -ne 2p kw.c)"
@@ -94,10 +95,11 @@ test_expect_success "propset CR on crlf files" ' ) ' -test_expect_success 'fetch and pull latest from svn and checkout a new wc' \ - 'git svn fetch && - git pull . remotes/git-svn && - svn_cmd co "$svnrepo" new_wc' +test_expect_success 'fetch and pull latest from svn and checkout a new wc' ' + git svn fetch && + git pull . remotes/git-svn && + svn_cmd co "$svnrepo" new_wc +' for i in crlf ne_crlf lf ne_lf cr ne_cr empty_cr empty_lf empty empty_crlf do
@@ -110,15 +112,17 @@ cd test_wc printf '$Id$\rHello\rWorld' >ne_cr a_cr=$(printf '$Id$\r\nHello\r\nWorld\r\n' | git hash-object --stdin) a_ne_cr=$(printf '$Id$\r\nHello\r\nWorld' | git hash-object --stdin) - test_expect_success 'Set CRLF on cr files' \ - 'svn_cmd propset svn:eol-style CRLF cr && - svn_cmd propset svn:eol-style CRLF ne_cr && - svn_cmd propset svn:keywords Id cr && - svn_cmd propset svn:keywords Id ne_cr && - svn_cmd commit -m "propset CRLF on cr files"' + test_expect_success 'Set CRLF on cr files' ' + svn_cmd propset svn:eol-style CRLF cr && + svn_cmd propset svn:eol-style CRLF ne_cr && + svn_cmd propset svn:keywords Id cr && + svn_cmd propset svn:keywords Id ne_cr && + svn_cmd commit -m "propset CRLF on cr files" + ' cd .. -test_expect_success 'fetch and pull latest from svn' \ - 'git svn fetch && git pull . remotes/git-svn' +test_expect_success 'fetch and pull latest from svn' ' + git svn fetch && git pull . remotes/git-svn +' b_cr="$(git hash-object cr)" b_ne_cr="$(git hash-object ne_cr)"
@@ -141,7 +145,7 @@ cat >show-ignore.expect <<\EOF /deeply/nested/directory/no-such-file* EOF -test_expect_success 'test show-ignore' " +test_expect_success 'test show-ignore' ' ( cd test_wc && mkdir -p deeply/nested/directory &&
@@ -155,7 +159,7 @@ no-such-file* ) && git svn show-ignore >show-ignore.got && cmp show-ignore.expect show-ignore.got -" +' cat >create-ignore.expect <<\EOF /no-such-file*
@@ -170,7 +174,7 @@ cat >create-ignore-index.expect <<EOF 100644 $expectoid 0 deeply/nested/directory/.gitignore EOF -test_expect_success 'test create-ignore' " +test_expect_success 'test create-ignore' ' git svn fetch && git pull . remotes/git-svn && git svn create-ignore && cmp ./.gitignore create-ignore.expect &&
@@ -179,7 +183,7 @@ test_expect_success 'test create-ignore' " cmp ./deeply/nested/directory/.gitignore create-ignore.expect && git ls-files -s >ls_files_result && grep gitignore ls_files_result | cmp - create-ignore-index.expect - " +' cat >prop.expect <<\EOF
@@ -207,7 +211,7 @@ test_expect_success 'test propget' ' test_propget svn:ignore nested/ ../prop.expect && test_propget svn:ignore ./nested ../prop.expect && test_propget svn:ignore .././deeply/nested ../prop.expect - ' +' cat >prop.expect <<\EOF Properties on '.':
@@ -225,12 +229,12 @@ Properties on 'nested/directory/.keep': svn:entry:uuid EOF -test_expect_success 'test proplist' " +test_expect_success 'test proplist' ' git svn proplist . >actual && cmp prop.expect actual && git svn proplist nested/directory/.keep >actual && cmp prop2.expect actual - " +' test_done
Signature · 1 line
2.47.0.86.g15030f9556
Quoted 138 lines · Seyi Kuforiji
The current script uses an outdated formatting style for
test_expect_successblocks, where each argument is separated by a backslash and newline. This style can lead to readability issues and makes it harder to maintain the script.The modern style consolidates the multi-line command arguments into a single quoted block, which improves readability, maintainability, and aligns the code with current coding standards.Signed-off-by Seyi Kuforiji <[email protected]>--- t/t9101-git-svn-props.sh | 48 ++++++++++++++++++++++------------------ 1 file changed, 26 insertions(+), 22 deletions(-)t/t9101-git-svn-props.sh +26
-23@@ -73,12 +73,13 @@ test_expect_success 'initialize git svn' 'git svn init "$svnrepo"' test_expect_success 'fetch revisions from svn' 'git svn fetch' name='test svn:keywords ignoring' -test_expect_success "$name" \ - 'git checkout -b mybranch remotes/git-svn && +test_expect_success "$name" ' + git checkout -b mybranch remotes/git-svn && echo Hi again >>kw.c && git commit -a -m "test keywords ignoring" && git svn set-tree remotes/git-svn..mybranch && - git pull . remotes/git-svn' + git pull . remotes/git-svn +' expect='/* $Id$ */' got="$(sed -ne 2p kw.c)"@@ -94,10 +95,11 @@ test_expect_success "propset CR on crlf files" ' ) ' -test_expect_success 'fetch and pull latest from svn and checkout a new wc' \ - 'git svn fetch && - git pull . remotes/git-svn && - svn_cmd co "$svnrepo" new_wc' +test_expect_success 'fetch and pull latest from svn and checkout a new wc' ' + git svn fetch && + git pull . remotes/git-svn && + svn_cmd co "$svnrepo" new_wc +' for i in crlf ne_crlf lf ne_lf cr ne_cr empty_cr empty_lf empty empty_crlf do@@ -110,15 +112,17 @@ cd test_wc printf '$Id$\rHello\rWorld' >ne_cr a_cr=$(printf '$Id$\r\nHello\r\nWorld\r\n' | git hash-object --stdin) a_ne_cr=$(printf '$Id$\r\nHello\r\nWorld' | git hash-object --stdin) - test_expect_success 'Set CRLF on cr files' \ - 'svn_cmd propset svn:eol-style CRLF cr && - svn_cmd propset svn:eol-style CRLF ne_cr && - svn_cmd propset svn:keywords Id cr && - svn_cmd propset svn:keywords Id ne_cr && - svn_cmd commit -m "propset CRLF on cr files"' + test_expect_success 'Set CRLF on cr files' ' + svn_cmd propset svn:eol-style CRLF cr && + svn_cmd propset svn:eol-style CRLF ne_cr && + svn_cmd propset svn:keywords Id cr && + svn_cmd propset svn:keywords Id ne_cr && + svn_cmd commit -m "propset CRLF on cr files" + ' cd .. -test_expect_success 'fetch and pull latest from svn' \ - 'git svn fetch && git pull . remotes/git-svn' +test_expect_success 'fetch and pull latest from svn' ' + git svn fetch && git pull . remotes/git-svn +' b_cr="$(git hash-object cr)" b_ne_cr="$(git hash-object ne_cr)"@@ -141,7 +145,7 @@ cat >show-ignore.expect <<\EOF /deeply/nested/directory/no-such-file* EOF -test_expect_success 'test show-ignore' " +test_expect_success 'test show-ignore' ' ( cd test_wc && mkdir -p deeply/nested/directory &&@@ -155,7 +159,7 @@ no-such-file* ) && git svn show-ignore >show-ignore.got && cmp show-ignore.expect show-ignore.got -" +' cat >create-ignore.expect <<\EOF /no-such-file*@@ -170,7 +174,7 @@ cat >create-ignore-index.expect <<EOF 100644 $expectoid 0 deeply/nested/directory/.gitignore EOF -test_expect_success 'test create-ignore' " +test_expect_success 'test create-ignore' ' git svn fetch && git pull . remotes/git-svn && git svn create-ignore && cmp ./.gitignore create-ignore.expect &&@@ -179,7 +183,7 @@ test_expect_success 'test create-ignore' " cmp ./deeply/nested/directory/.gitignore create-ignore.expect && git ls-files -s >ls_files_result && grep gitignore ls_files_result | cmp - create-ignore-index.expect - " +' cat >prop.expect <<\EOF@@ -207,7 +211,7 @@ test_expect_success 'test propget' ' test_propget svn:ignore nested/ ../prop.expect && test_propget svn:ignore ./nested ../prop.expect && test_propget svn:ignore .././deeply/nested ../prop.expect - ' +' cat >prop.expect <<\EOF Properties on '.':@@ -225,12 +229,12 @@ Properties on 'nested/directory/.keep': svn:entry:uuid EOF -test_expect_success 'test proplist' " +test_expect_success 'test proplist' ' git svn proplist . >actual && cmp prop.expect actual && git svn proplist nested/directory/.keep >actual && cmp prop2.expect actual - " +' test_done --
Quoted 2 lines
2.47.0.86.g15030f9556
Hi Taylor,
I trust you're well.
I didn't get any status update on the patch I updated the commit message, found here:
https://public-inbox.org/git/[email protected]/
Is it good to go?
Thanks
Seyi