Merge branch 'ss/t7401-modernize'

Test clean-up.

* ss/t7401-modernize:
  t7401: add a NEEDSWORK
  t7401: change indentation for enhanced readability
  t7401: change syntax of test_i18ncmp calls for clarity
  t7401: use 'short' instead of 'verify' and cut in rev-parse calls
  t7401: modernize style
This commit is contained in:
Junio C Hamano
2020-09-03 12:37:01 -07:00

View File

@ -5,8 +5,11 @@
test_description='Summary support for submodules test_description='Summary support for submodules
This test tries to verify the sanity of summary subcommand of git submodule. This test script tries to verify the sanity of summary subcommand of git submodule.
' '
# NEEDSWORK: This test script is old fashioned and may need a big cleanup due to
# various reasons, one of them being that there are lots of commands taking place
# outside of 'test_expect_success' block, which is no longer in good-style.
. ./test-lib.sh . ./test-lib.sh
@ -21,7 +24,7 @@ add_file () {
test_tick && test_tick &&
git commit -m "Add $name" git commit -m "Add $name"
done >/dev/null done >/dev/null
git rev-parse --verify HEAD | cut -c1-7 git rev-parse --short HEAD
cd "$owd" cd "$owd"
} }
commit_file () { commit_file () {
@ -125,7 +128,7 @@ commit_file sm1 &&
head3=$( head3=$(
cd sm1 && cd sm1 &&
git reset --hard HEAD~2 >/dev/null && git reset --hard HEAD~2 >/dev/null &&
git rev-parse --verify HEAD | cut -c1-7 git rev-parse --short HEAD
) )
test_expect_success 'modified submodule(backward)' " test_expect_success 'modified submodule(backward)' "
@ -181,7 +184,7 @@ test_expect_success 'typechanged submodule(submodule->blob), --cached' "
< Add foo5 < Add foo5
EOF EOF
test_i18ncmp actual expected test_i18ncmp expected actual
" "
test_expect_success 'typechanged submodule(submodule->blob), --files' " test_expect_success 'typechanged submodule(submodule->blob), --files' "
@ -191,7 +194,7 @@ test_expect_success 'typechanged submodule(submodule->blob), --files' "
> Add foo5 > Add foo5
EOF EOF
test_i18ncmp actual expected test_i18ncmp expected actual
" "
rm -rf sm1 && rm -rf sm1 &&
@ -202,7 +205,7 @@ test_expect_success 'typechanged submodule(submodule->blob)' "
* sm1 $head4(submodule)->$head5(blob): * sm1 $head4(submodule)->$head5(blob):
EOF EOF
test_i18ncmp actual expected test_i18ncmp expected actual
" "
rm -f sm1 && rm -f sm1 &&
@ -215,7 +218,7 @@ test_expect_success 'nonexistent commit' "
Warn: sm1 doesn't contain commit $head4_full Warn: sm1 doesn't contain commit $head4_full
EOF EOF
test_i18ncmp actual expected test_i18ncmp expected actual
" "
commit_file commit_file
@ -283,7 +286,7 @@ EOF
test_expect_success '--for-status' " test_expect_success '--for-status' "
git submodule summary --for-status HEAD^ >actual && git submodule summary --for-status HEAD^ >actual &&
test_i18ncmp actual - <<EOF test_i18ncmp - actual <<-EOF
* sm1 $head6...0000000: * sm1 $head6...0000000:
* sm2 0000000...$head7 (2): * sm2 0000000...$head7 (2):