From: COGONI Guillaume Date: Tue, 22 Feb 2022 21:54:30 +0000 (+0100) Subject: tests: make the code more readable X-Git-Tag: v2.36.0-rc0~101^2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=cc143f12a781afaef3de89450bc2b4d233058809;p=thirdparty%2Fgit.git tests: make the code more readable Replace the parsing of the output of "ls -l" by test_path_is_symlink() and test_readlink(). Signed-off-by: COGONI Guillaume Co-authored-by: BRESSAT Jonathan Signed-off-by: Junio C Hamano --- diff --git a/t/t3903-stash.sh b/t/t3903-stash.sh index 0a82bc857d..1855181520 100755 --- a/t/t3903-stash.sh +++ b/t/t3903-stash.sh @@ -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