ProcessTest.cpp - replace Optional::hasValue() with Optional::has_value()

Fixes windows-only build warnings
This commit is contained in:
Simon Pilgrim 2022-08-08 11:52:22 +01:00
parent 72017e9b16
commit fb10bb0d2c
1 changed files with 4 additions and 4 deletions

View File

@ -46,14 +46,14 @@ TEST(ProcessTest, GetRandomNumberTest) {
TEST(ProcessTest, Basic) {
setenv("__LLVM_TEST_ENVIRON_VAR__", "abc", true);
Optional<std::string> val(Process::GetEnv("__LLVM_TEST_ENVIRON_VAR__"));
EXPECT_TRUE(val.hasValue());
EXPECT_TRUE(val.has_value());
EXPECT_STREQ("abc", val->c_str());
}
TEST(ProcessTest, None) {
Optional<std::string> val(
Process::GetEnv("__LLVM_TEST_ENVIRON_NO_SUCH_VAR__"));
EXPECT_FALSE(val.hasValue());
EXPECT_FALSE(val.has_value());
}
#endif
@ -62,14 +62,14 @@ TEST(ProcessTest, None) {
TEST(ProcessTest, EmptyVal) {
SetEnvironmentVariableA("__LLVM_TEST_ENVIRON_VAR__", "");
Optional<std::string> val(Process::GetEnv("__LLVM_TEST_ENVIRON_VAR__"));
EXPECT_TRUE(val.hasValue());
EXPECT_TRUE(val.has_value());
EXPECT_STREQ("", val->c_str());
}
TEST(ProcessTest, Wchar) {
SetEnvironmentVariableW(L"__LLVM_TEST_ENVIRON_VAR__", L"abcdefghijklmnopqrs");
Optional<std::string> val(Process::GetEnv("__LLVM_TEST_ENVIRON_VAR__"));
EXPECT_TRUE(val.hasValue());
EXPECT_TRUE(val.has_value());
EXPECT_STREQ("abcdefghijklmnopqrs", val->c_str());
}
#endif