Skip to content

Commit cc143f1

Browse files
WoodfeaSIr-Lorrak
authored andcommitted
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 <[email protected]> Co-authored-by: BRESSAT Jonathan <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 456296b commit cc143f1

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

t/t3903-stash.sh

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -393,7 +393,8 @@ test_expect_success SYMLINKS 'stash file to symlink' '
393393
test_path_is_file_not_symlink file &&
394394
test bar = "$(cat file)" &&
395395
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
397398
'
398399

399400
test_expect_success SYMLINKS 'stash file to symlink (stage rm)' '
@@ -404,7 +405,8 @@ test_expect_success SYMLINKS 'stash file to symlink (stage rm)' '
404405
test_path_is_file_not_symlink file &&
405406
test bar = "$(cat file)" &&
406407
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
408410
'
409411

410412
test_expect_success SYMLINKS 'stash file to symlink (full stage)' '
@@ -416,7 +418,8 @@ test_expect_success SYMLINKS 'stash file to symlink (full stage)' '
416418
test_path_is_file_not_symlink file &&
417419
test bar = "$(cat file)" &&
418420
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
420423
'
421424

422425
# This test creates a commit with a symlink used for the following tests

0 commit comments

Comments
 (0)