From: Ævar Arnfjörð Bjarmason Date: Fri, 12 Feb 2021 13:29:41 GMT Subject: [PATCH v2 10/11] test-lib-functions: remove bug-inducing "diagnostics" helper param Message-ID: <20210212132942.17325-11-avarab@gmail.com> In-Reply-To: <20210209214159.22815-1-avarab@gmail.com> Remove the optional "diagnostics" parameter of the test_path_is_{file,dir,missing} functions. We have a lot of uses of these functions, but the only legitimate use of the diagnostics parameter is from when the functions themselves were introduced in 2caf20c52b7 (test-lib: user-friendly alternatives to test [-d|-f|-e], 2010-08-10). But as the the rest of this diff demonstrates its presence did more to silently introduce bugs in our tests. Fix such bugs in the tests added in ae4e89e549b (gc: add --keep-largest-pack option, 2018-04-15), and c04ba51739a (t6046: testcases checking whether updates can be skipped in a merge, 2018-04-19). Let's also assert that those functions are called with exactly one parameter, a follow-up commit will add similar asserts to other functions in test-lib-functions.sh that we didn't have existing misuse of. Signed-off-by: Ævar Arnfjörð Bjarmason --- t/README | 8 ++++---- t/t3404-rebase-interactive.sh | 3 ++- t/t6426-merge-skip-unneeded-updates.sh | 16 ++++++++++++---- t/t6500-gc.sh | 4 ++-- t/test-lib-functions.sh | 11 ++++++----- 5 files changed, 26 insertions(+), 16 deletions(-) diff --git a/t/README b/t/README index 1d80fb70041..98d4164a4e6 100644 --- a/t/README +++ b/t/README @@ -911,13 +911,13 @@ library for your script to use. Check whether a file has the length it is expected to. - - test_path_is_file [] - test_path_is_dir [] - test_path_is_missing [] + - test_path_is_file + test_path_is_dir + test_path_is_missing Check if the named path is a file, if the named path is a directory, or if the named path does not exist, respectively, - and fail otherwise, showing the text. + and fail otherwise. - test_when_finished