Message ID | f3cb583110f508b4a421326ea6667280e848930d.1571354136.git.liu.denton@gmail.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | t5520: various test cleanup | expand |
On Thu, Oct 17, 2019 at 7:17 PM Denton Liu <liu.denton@gmail.com> wrote: > Although `test -f` has the same functionality as test_path_is_file(), in > the case where test_path_is_file() fails, we get much better debugging > information. Replace `test -f` with test_path_is_file so that future > developers will have a better experience debugging these test cases. > > Signed-off-by: Denton Liu <liu.denton@gmail.com> > --- > diff --git a/t/t5520-pull.sh b/t/t5520-pull.sh > @@ -99,7 +99,7 @@ test_expect_success 'pulling into void must not create an octopus' ' > ( > cd cloned-octopus && > test_must_fail git pull .. master master && > - ! test -f file > + test_must_fail test_path_is_file file > ) According to t/README, this is not a valid use of test_must_fail(), which is reserved for detecting failure of Git commands. Either use '!' as the original code did, or perhaps use test_path_is_missing().
diff --git a/t/t5520-pull.sh b/t/t5520-pull.sh index 55560ce3cd..5ab5ec508a 100755 --- a/t/t5520-pull.sh +++ b/t/t5520-pull.sh @@ -39,8 +39,8 @@ test_expect_success 'pulling into void' ' cd cloned && git pull .. ) && - test -f file && - test -f cloned/file && + test_path_is_file file && + test_path_is_file cloned/file && test_cmp file cloned/file ' @@ -50,8 +50,8 @@ test_expect_success 'pulling into void using master:master' ' cd cloned-uho && git pull .. master:master ) && - test -f file && - test -f cloned-uho/file && + test_path_is_file file && + test_path_is_file cloned-uho/file && test_cmp file cloned-uho/file ' @@ -99,7 +99,7 @@ test_expect_success 'pulling into void must not create an octopus' ' ( cd cloned-octopus && test_must_fail git pull .. master master && - ! test -f file + test_must_fail test_path_is_file file ) '
Although `test -f` has the same functionality as test_path_is_file(), in the case where test_path_is_file() fails, we get much better debugging information. Replace `test -f` with test_path_is_file so that future developers will have a better experience debugging these test cases. Signed-off-by: Denton Liu <liu.denton@gmail.com> --- t/t5520-pull.sh | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)