From 6758c3f4001c16373333d9c3e627d04b98af55c8 Mon Sep 17 00:00:00 2001 From: Gavin Hayes Date: Sat, 15 Apr 2023 09:26:13 -0400 Subject: [PATCH] commandv: fix dir tests on non-NT (#764) --- test/libc/calls/commandv_test.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/test/libc/calls/commandv_test.c b/test/libc/calls/commandv_test.c index 0b4705f67..7b96a3ab6 100644 --- a/test/libc/calls/commandv_test.c +++ b/test/libc/calls/commandv_test.c @@ -118,18 +118,20 @@ TEST(commandv, testSameDir_willHappenWithColonBlank2) { } TEST(commandv, test_DirPaths_wontConsiderDirectoriesExecutable) { + CHECK_NE(-1, setenv("PATH", ":bin", true)); EXPECT_NE(-1, mkdir("Cursors", 0755)); EXPECT_EQ(NULL, commandv("Cursors", pathbuf, sizeof(pathbuf))); - EXPECT_EQ(errno, ENOENT); + if (IsWindows()) { + EXPECT_EQ(errno, ENOENT); + } else { + EXPECT_EQ(errno, EACCES); + } } TEST(commandv, test_DirPaths_wontConsiderDirectoriesExecutable2) { + CHECK_NE(-1, setenv("PATH", ":bin", true)); EXPECT_NE(-1, mkdir("this_is_a_directory.com", 0755)); EXPECT_EQ(NULL, commandv("this_is_a_directory.com", pathbuf, sizeof(pathbuf))); - if (IsWindows()) { - EXPECT_EQ(errno, EACCES); - } else { - EXPECT_EQ(errno, ENOENT); - } + EXPECT_EQ(errno, EACCES); }