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 <cogoni.guillaume@gmail.com> Co-authored-by: BRESSAT Jonathan <git.jonathan.bressat@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

COGONI Guillaume committed Feb 22, 2022 at 22:54 UTC cc143f12a781afaef3de89450bc2b4d233058809
1 file changed +6 -3
t/t3903-stash.sh
+6 -3
@@ -393,7 +393,8 @@ test_expect_success SYMLINKS 'stash file to symlink' '
393 test_path_is_file_not_symlink file &&
394 test bar = "$(cat file)" &&
395 git stash apply &&
396 - case "$(ls -l file)" in *" file -> file2") :;; *) false;; esac
396 + test_path_is_symlink file &&
397 + test "$(test_readlink file)" = file2
398 '
399
400 test_expect_success SYMLINKS 'stash file to symlink (stage rm)' '
@@ -404,7 +405,8 @@ test_expect_success SYMLINKS 'stash file to symlink (stage rm)' '
405 test_path_is_file_not_symlink file &&
406 test bar = "$(cat file)" &&
407 git stash apply &&
407 - case "$(ls -l file)" in *" file -> file2") :;; *) false;; esac
408 + test_path_is_symlink file &&
409 + test "$(test_readlink file)" = file2
410 '
411
412 test_expect_success SYMLINKS 'stash file to symlink (full stage)' '
@@ -416,7 +418,8 @@ test_expect_success SYMLINKS 'stash file to symlink (full stage)' '
418 test_path_is_file_not_symlink file &&
419 test bar = "$(cat file)" &&
420 git stash apply &&
419 - case "$(ls -l file)" in *" file -> file2") :;; *) false;; esac
421 + test_path_is_symlink file &&
422 + test "$(test_readlink file)" = file2
423 '
424
425 # This test creates a commit with a symlink used for the following tests