From 0b400af9519444deef4cc6ad2c43c30e2092ab4f Mon Sep 17 00:00:00 2001 From: Dominick Allen Date: Sat, 4 Jan 2025 09:56:12 -0600 Subject: Fix bug related to string copying. --- test/test_fud.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'test/test_fud.cpp') diff --git a/test/test_fud.cpp b/test/test_fud.cpp index f84ad20..8dea206 100644 --- a/test/test_fud.cpp +++ b/test/test_fud.cpp @@ -33,6 +33,7 @@ TEST(FudTest, FudFud) auto compareResult = compareMem( fudInfo.revision.data(), fudInfo.revision.size(), + // NOLINTNEXTLINE(cppcoreguidelines-pro-bounds-array-to-pointer-decay) FudGitHash, fudInfo.revision.size() - 1); ASSERT_TRUE(compareResult.isOkay()); @@ -52,14 +53,18 @@ TEST(FudTest, GetEnv) ASSERT_EQ(fudVarResult.getError(), FudStatus::NullPointer); fudVarResult = std::move(getEnv(testVarName)); - ASSERT_TRUE(fudVarResult.isError()); - ASSERT_EQ(fudVarResult.getError(), FudStatus::NotFound); + ASSERT_TRUE(fudVarResult.isOkay()); + ASSERT_TRUE(fudVarResult.getOkay().isNone()); ASSERT_EQ(setenv(testVarName, testVarValue, 1), 0); + ASSERT_NE(getenv(testVarName), nullptr); + ASSERT_STREQ(getenv(testVarName), testVarValue); + fudVarResult = getEnv(testVarName); ASSERT_TRUE(fudVarResult.isOkay()); auto fudVar{fudVarResult.takeOkay()}; - ASSERT_STREQ(fudVar.c_str(), testVarValue); + ASSERT_TRUE(fudVar.hasValue()); + ASSERT_STREQ(fudVar.value().c_str(), testVarValue); } } // namespace fud -- cgit v1.2.3