]> git.ipfire.org Git - thirdparty/git.git/commitdiff
tests: make the code more readable
authorCOGONI Guillaume <cogoni.guillaume@gmail.com>
Tue, 22 Feb 2022 21:54:30 +0000 (22:54 +0100)
committerJunio C Hamano <gitster@pobox.com>
Wed, 23 Feb 2022 23:08:44 +0000 (15:08 -0800)
Replace the parsing of the output of "ls -l" by test_path_is_symlink() and
test_readlink().

Signed-off-by: COGONI Guillaume <cogoni.guillaume@gmail.com>
Co-authored-by: BRESSAT Jonathan <git.jonathan.bressat@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
t/t3903-stash.sh

index 0a82bc857d16ad46fafe8dbc74b4038a4c38722b..185518152017a57599f1c15280ccd14ba27297a7 100755 (executable)
@@ -393,7 +393,8 @@ test_expect_success SYMLINKS 'stash file to symlink' '
        test_path_is_file_not_symlink file &&
        test bar = "$(cat file)" &&
        git stash apply &&
-       case "$(ls -l file)" in *" file -> file2") :;; *) false;; esac
+       test_path_is_symlink file &&
+       test "$(test_readlink file)" = file2
 '
 
 test_expect_success SYMLINKS 'stash file to symlink (stage rm)' '
@@ -404,7 +405,8 @@ test_expect_success SYMLINKS 'stash file to symlink (stage rm)' '
        test_path_is_file_not_symlink file &&
        test bar = "$(cat file)" &&
        git stash apply &&
-       case "$(ls -l file)" in *" file -> file2") :;; *) false;; esac
+       test_path_is_symlink file &&
+       test "$(test_readlink file)" = file2
 '
 
 test_expect_success SYMLINKS 'stash file to symlink (full stage)' '
@@ -416,7 +418,8 @@ test_expect_success SYMLINKS 'stash file to symlink (full stage)' '
        test_path_is_file_not_symlink file &&
        test bar = "$(cat file)" &&
        git stash apply &&
-       case "$(ls -l file)" in *" file -> file2") :;; *) false;; esac
+       test_path_is_symlink file &&
+       test "$(test_readlink file)" = file2
 '
 
 # This test creates a commit with a symlink used for the following tests