Skip to content

Commit cc8f95c

Browse files
Martin Ågrenttaylorr
authored andcommitted
test-lib-functions: drop redundant diagnostic print
`test_path_is_missing` was introduced back in 2caf20c ("test-lib: user-friendly alternatives to test [-d|-f|-e]", 2010-08-10). It took the path that was supposed to be missing, as well as an optional "diagnosis" that would be echoed if the path was found to be alive. Commit 45a2686 ("test-lib-functions: remove bug-inducing "diagnostics" helper param", 2021-02-12) dropped this diagnostic functionality from several `test_path_is_foo` helpers, but note how it tweaked the README entry on `test_path_is_missing` without actually adjusting its implementation. Commit e7884b3 ("test-lib-functions: assert correct parameter count", 2021-02-12) then followed up by asserting that we get just a single argument. This history leaves us in a state where we assert that we have exactly one argument, then go on to anyway check for arguments, echoing them all. It's clear that we can simplify this code. We should also note that we run `ls -ld "$1"`, so printing the filename a second time doesn't really buy us anything. Thus, we can drop the whole `if` block as redundant. Signed-off-by: Martin Ågren <[email protected]> Signed-off-by: Taylor Blau <[email protected]>
1 parent c03801e commit cc8f95c

File tree

1 file changed

+0
-4
lines changed

1 file changed

+0
-4
lines changed

t/test-lib-functions.sh

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -921,10 +921,6 @@ test_path_is_missing () {
921921
then
922922
echo "Path exists:"
923923
ls -ld "$1"
924-
if test $# -ge 1
925-
then
926-
echo "$*"
927-
fi
928924
false
929925
fi
930926
}

0 commit comments

Comments
 (0)