From ac5ae3cf5dc4c5f87293c45a1d6999f8d1515b39 Mon Sep 17 00:00:00 2001 From: Bernie Innocenti Date: Wed, 12 Feb 2020 10:43:42 +0900 Subject: Convert native_loader_test.cpp to Result::ok() Test: m checkbuild Change-Id: I9feb590e37174fa5021f69bf55dbfffba957584d --- libnativeloader/native_loader_test.cpp | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'libnativeloader/native_loader_test.cpp') diff --git a/libnativeloader/native_loader_test.cpp b/libnativeloader/native_loader_test.cpp index 39cc753aa4..7064c161a2 100644 --- a/libnativeloader/native_loader_test.cpp +++ b/libnativeloader/native_loader_test.cpp @@ -601,7 +601,7 @@ libD.so )"; const std::vector expected_result = {"libA.so", "libC.so", "libD.so"}; Result> 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 @@ libC.so const std::vector expected_result = {"libA.so", "libC.so"}; #endif Result> 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 @@ libC.so Result> result = ParseConfig(file_content, [](const struct ConfigEntry& entry) -> Result { return !entry.nopreload; }); - ASSERT_TRUE(result) << result.error().message(); + ASSERT_RESULT_OK(result); ASSERT_EQ(expected_result, *result); } @@ -653,17 +653,17 @@ libE.so nopreload Result> result = ParseConfig(file_content, [](const struct ConfigEntry& entry) -> Result { 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 -- cgit v1.2.3-59-g8ed1b