forked from OSchip/llvm-project
ProcessTest.cpp - replace Optional::hasValue() with Optional::has_value()
Fixes windows-only build warnings
This commit is contained in:
parent
72017e9b16
commit
fb10bb0d2c
|
@ -46,14 +46,14 @@ TEST(ProcessTest, GetRandomNumberTest) {
|
||||||
TEST(ProcessTest, Basic) {
|
TEST(ProcessTest, Basic) {
|
||||||
setenv("__LLVM_TEST_ENVIRON_VAR__", "abc", true);
|
setenv("__LLVM_TEST_ENVIRON_VAR__", "abc", true);
|
||||||
Optional<std::string> val(Process::GetEnv("__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("abc", val->c_str());
|
EXPECT_STREQ("abc", val->c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(ProcessTest, None) {
|
TEST(ProcessTest, None) {
|
||||||
Optional<std::string> val(
|
Optional<std::string> val(
|
||||||
Process::GetEnv("__LLVM_TEST_ENVIRON_NO_SUCH_VAR__"));
|
Process::GetEnv("__LLVM_TEST_ENVIRON_NO_SUCH_VAR__"));
|
||||||
EXPECT_FALSE(val.hasValue());
|
EXPECT_FALSE(val.has_value());
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -62,14 +62,14 @@ TEST(ProcessTest, None) {
|
||||||
TEST(ProcessTest, EmptyVal) {
|
TEST(ProcessTest, EmptyVal) {
|
||||||
SetEnvironmentVariableA("__LLVM_TEST_ENVIRON_VAR__", "");
|
SetEnvironmentVariableA("__LLVM_TEST_ENVIRON_VAR__", "");
|
||||||
Optional<std::string> val(Process::GetEnv("__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());
|
EXPECT_STREQ("", val->c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(ProcessTest, Wchar) {
|
TEST(ProcessTest, Wchar) {
|
||||||
SetEnvironmentVariableW(L"__LLVM_TEST_ENVIRON_VAR__", L"abcdefghijklmnopqrs");
|
SetEnvironmentVariableW(L"__LLVM_TEST_ENVIRON_VAR__", L"abcdefghijklmnopqrs");
|
||||||
Optional<std::string> val(Process::GetEnv("__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("abcdefghijklmnopqrs", val->c_str());
|
EXPECT_STREQ("abcdefghijklmnopqrs", val->c_str());
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue