This test has been dysfunctional since it was added by 259f3ee296
(lib-submodule-update.sh: define tests for recursing into submodules,
2017-03-14), however, problems went unnoticed due to a broken &&-chain
toward the end of the test.

The test wants to verify that replacing a submodule containing a .git
directory must fail. All other "must fail" tests in this script invoke
the supplied command as 'test_must_fail', however, this test neglects to
do so.

To make matters worse, the command actually succeeds even though it's
not supposed to. Presumably, this is a "known breakage", which means
that the entire test should be marked 'test_expect_failure', however, it
is instead marked 'test_expect_success'.

Fix both problems, as well as the broken &&-chain behind which these
problems hid.

While at it, fix broken &&-chains in a couple neighboring tests.

Signed-off-by: Eric Sunshine <sunsh...@sunshineco.com>
---
 t/lib-submodule-update.sh | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/t/lib-submodule-update.sh b/t/lib-submodule-update.sh
index 1f38a85371..8a2edee1cb 100755
--- a/t/lib-submodule-update.sh
+++ b/t/lib-submodule-update.sh
@@ -755,7 +755,7 @@ test_submodule_recursing_with_args_common() {
                        : >sub1/untrackedfile &&
                        test_must_fail $command replace_sub1_with_file &&
                        test_superproject_content origin/add_sub1 &&
-                       test_submodule_content sub1 origin/add_sub1
+                       test_submodule_content sub1 origin/add_sub1 &&
                        test -f sub1/untracked_file
                )
        '
@@ -842,7 +842,7 @@ test_submodule_switch_recursing_with_args () {
                        cd submodule_update &&
                        git branch -t add_sub1 origin/add_sub1 &&
                        : >sub1 &&
-                       echo sub1 >.git/info/exclude
+                       echo sub1 >.git/info/exclude &&
                        $command add_sub1 &&
                        test_superproject_content origin/add_sub1 &&
                        test_submodule_content sub1 origin/add_sub1
@@ -959,7 +959,7 @@ test_submodule_forced_switch_recursing_with_args () {
                )
        '
        # ... absorbing a .git directory.
-       test_expect_success "$command: replace submodule containing a .git 
directory with a directory must fail" '
+       test_expect_failure "$command: replace submodule containing a .git 
directory with a directory must fail" '
                prolog &&
                reset_work_tree_to_interested add_sub1 &&
                (
@@ -967,9 +967,9 @@ test_submodule_forced_switch_recursing_with_args () {
                        git branch -t replace_sub1_with_directory 
origin/replace_sub1_with_directory &&
                        replace_gitfile_with_git_dir sub1 &&
                        rm -rf .git/modules/sub1 &&
-                       $command replace_sub1_with_directory &&
+                       test_must_fail $command replace_sub1_with_directory &&
                        test_superproject_content 
origin/replace_sub1_with_directory &&
-                       test_submodule_content sub1 origin/modify_sub1
+                       test_submodule_content sub1 origin/modify_sub1 &&
                        test_git_directory_exists sub1
                )
        '
-- 
2.18.0.419.gfe4b301394

Reply via email to