{"thread":{"id":"58724","subject":"[PATCH] test-lib-functions: drop redundant diagnostic print","startedAt":"2022-10-31T18:01:35Z","lastAt":"2022-11-01T01:11:53Z","messageCount":3,"participants":["Martin Ågren","Ævar Arnfjörð Bjarmason","Taylor Blau"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"466103","messageId":"20221031180048.5766-1-martin.agren@gmail.com","threadId":"58724","inReplyTo":null,"subject":"[PATCH] test-lib-functions: drop redundant diagnostic print","fromName":"Martin Ågren","fromEmail":"martin.agren@gmail.com","sentAt":"2022-10-31T18:00:48Z","receivedAt":"2022-10-31T18:01:35Z","isPatch":true,"sender":{"key":"martin.agren@gmail.com","avatar":null},"body":"`test_path_is_missing` was introduced back in 2caf20c52b (\"test-lib:\nuser-friendly alternatives to test [-d|-f|-e]\", 2010-08-10). It took the\npath that was supposed to be missing, as well as an optional \"diagnosis\"\nthat would be echoed if the path was found to be alive.\n\nCommit 45a2686441 (\"test-lib-functions: remove bug-inducing\n\"diagnostics\" helper param\", 2021-02-12) dropped this diagnostic\nfunctionality from several `test_path_is_foo` helpers, but note how it\ntweaked the README entry on `test_path_is_missing` without actually\nadjusting its implementation.\n\nCommit e7884b353b (\"test-lib-functions: assert correct parameter count\",\n2021-02-12) then followed up by asserting that we get just a single\nargument.\n\nThis history leaves us in a state where we assert that we have exactly\none argument, then go on to anyway check for arguments, echoing them\nall. It's clear that we can simplify this code. We should also note that\nwe run `ls -ld \"$1\"`, so printing the filename a second time doesn't\nreally buy us anything. Thus, we can drop the whole `if` block as\nredundant.\n\nSigned-off-by: Martin Ågren <martin.agren@gmail.com>\n---\n t/test-lib-functions.sh | 4 ----\n 1 file changed, 4 deletions(-)\n\ndiff --git a/t/test-lib-functions.sh b/t/test-lib-functions.sh\nindex 29d914a12b..796093a7b3 100644\n--- a/t/test-lib-functions.sh\n+++ b/t/test-lib-functions.sh\n@@ -921,10 +921,6 @@ test_path_is_missing () {\n \tthen\n \t\techo \"Path exists:\"\n \t\tls -ld \"$1\"\n-\t\tif test $# -ge 1\n-\t\tthen\n-\t\t\techo \"$*\"\n-\t\tfi\n \t\tfalse\n \tfi\n }\n-- \n2.38.1.452.g9c842762fa\n\n"},{"id":"466113","messageId":"221031.864jvj7noz.gmgdl@evledraar.gmail.com","threadId":"58724","inReplyTo":"20221031180048.5766-1-martin.agren@gmail.com","subject":"Re: [PATCH] test-lib-functions: drop redundant diagnostic print","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2022-10-31T20:16:07Z","receivedAt":"2022-10-31T20:17:22Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"\nOn Mon, Oct 31 2022, Martin Ågren wrote:\n\n> `test_path_is_missing` was introduced back in 2caf20c52b (\"test-lib:\n> user-friendly alternatives to test [-d|-f|-e]\", 2010-08-10). It took the\n> path that was supposed to be missing, as well as an optional \"diagnosis\"\n> that would be echoed if the path was found to be alive.\n>\n> Commit 45a2686441 (\"test-lib-functions: remove bug-inducing\n> \"diagnostics\" helper param\", 2021-02-12) dropped this diagnostic\n> functionality from several `test_path_is_foo` helpers, but note how it\n> tweaked the README entry on `test_path_is_missing` without actually\n> adjusting its implementation.\n>\n> Commit e7884b353b (\"test-lib-functions: assert correct parameter count\",\n> 2021-02-12) then followed up by asserting that we get just a single\n> argument.\n>\n> This history leaves us in a state where we assert that we have exactly\n> one argument, then go on to anyway check for arguments, echoing them\n> all. It's clear that we can simplify this code. We should also note that\n> we run `ls -ld \"$1\"`, so printing the filename a second time doesn't\n> really buy us anything. Thus, we can drop the whole `if` block as\n> redundant.\n>\n> Signed-off-by: Martin Ågren <martin.agren@gmail.com>\n> ---\n>  t/test-lib-functions.sh | 4 ----\n>  1 file changed, 4 deletions(-)\n>\n> diff --git a/t/test-lib-functions.sh b/t/test-lib-functions.sh\n> index 29d914a12b..796093a7b3 100644\n> --- a/t/test-lib-functions.sh\n> +++ b/t/test-lib-functions.sh\n> @@ -921,10 +921,6 @@ test_path_is_missing () {\n>  \tthen\n>  \t\techo \"Path exists:\"\n>  \t\tls -ld \"$1\"\n> -\t\tif test $# -ge 1\n> -\t\tthen\n> -\t\t\techo \"$*\"\n> -\t\tfi\n>  \t\tfalse\n>  \tfi\n>  }\n\nThanks, this is an obviously good change, sorry about leaving that loose\nend.\n"},{"id":"466158","messageId":"Y2ByT8sUTvp1S9EA@nand.local","threadId":"58724","inReplyTo":"20221031180048.5766-1-martin.agren@gmail.com","subject":"Re: [PATCH] test-lib-functions: drop redundant diagnostic print","fromName":"Taylor Blau","fromEmail":"me@ttaylorr.com","sentAt":"2022-11-01T01:11:43Z","receivedAt":"2022-11-01T01:11:53Z","isPatch":true,"sender":{"key":"me@ttaylorr.com","avatar":"https://avatars.githubusercontent.com/u/301000140?v=4"},"body":"On Mon, Oct 31, 2022 at 07:00:48PM +0100, Martin Ågren wrote:\n> ---\n>  t/test-lib-functions.sh | 4 ----\n>  1 file changed, 4 deletions(-)\n\nGood catch. Thanks, will queue.\n\nThanks,\nTaylor\n"}]}