Convert native_loader_test.cpp to Result::ok()
Test: m checkbuild
Change-Id: I9feb590e37174fa5021f69bf55dbfffba957584d
diff --git a/libnativeloader/native_loader_test.cpp b/libnativeloader/native_loader_test.cpp
index 39cc753..7064c16 100644
--- a/libnativeloader/native_loader_test.cpp
+++ b/libnativeloader/native_loader_test.cpp
@@ -601,7 +601,7 @@
)";
const std::vector<std::string> expected_result = {"libA.so", "libC.so", "libD.so"};
Result<std::vector<std::string>> result = ParseConfig(file_content, always_true);
- ASSERT_TRUE(result) << result.error().message();
+ ASSERT_RESULT_OK(result);
ASSERT_EQ(expected_result, *result);
}
@@ -617,7 +617,7 @@
const std::vector<std::string> expected_result = {"libA.so", "libC.so"};
#endif
Result<std::vector<std::string>> result = ParseConfig(file_content, always_true);
- ASSERT_TRUE(result) << result.error().message();
+ ASSERT_RESULT_OK(result);
ASSERT_EQ(expected_result, *result);
}
@@ -632,7 +632,7 @@
Result<std::vector<std::string>> result =
ParseConfig(file_content,
[](const struct ConfigEntry& entry) -> Result<bool> { return !entry.nopreload; });
- ASSERT_TRUE(result) << result.error().message();
+ ASSERT_RESULT_OK(result);
ASSERT_EQ(expected_result, *result);
}
@@ -653,17 +653,17 @@
Result<std::vector<std::string>> result =
ParseConfig(file_content,
[](const struct ConfigEntry& entry) -> Result<bool> { return !entry.nopreload; });
- ASSERT_TRUE(result) << result.error().message();
+ ASSERT_RESULT_OK(result);
ASSERT_EQ(expected_result, *result);
}
TEST(NativeLoaderConfigParser, RejectMalformed) {
- ASSERT_FALSE(ParseConfig("libA.so 32 64", always_true));
- ASSERT_FALSE(ParseConfig("libA.so 32 32", always_true));
- ASSERT_FALSE(ParseConfig("libA.so 32 nopreload 64", always_true));
- ASSERT_FALSE(ParseConfig("32 libA.so nopreload", always_true));
- ASSERT_FALSE(ParseConfig("nopreload libA.so 32", always_true));
- ASSERT_FALSE(ParseConfig("libA.so nopreload # comment", always_true));
+ ASSERT_FALSE(ParseConfig("libA.so 32 64", always_true).ok());
+ ASSERT_FALSE(ParseConfig("libA.so 32 32", always_true).ok());
+ ASSERT_FALSE(ParseConfig("libA.so 32 nopreload 64", always_true).ok());
+ ASSERT_FALSE(ParseConfig("32 libA.so nopreload", always_true).ok());
+ ASSERT_FALSE(ParseConfig("nopreload libA.so 32", always_true).ok());
+ ASSERT_FALSE(ParseConfig("libA.so nopreload # comment", always_true).ok());
}
} // namespace nativeloader