From da47ec3ca076477b994a5fdd7b777aed9b8cbdf4 Mon Sep 17 00:00:00 2001 From: "Duncan P. N. Exon Smith" Date: Mon, 25 Oct 2021 13:37:45 -0700 Subject: Basic: Stop using expectedToOptional() in FileManagerTest, NFC Remove a couple of uses of expectedToOptional() in FileManagerTest, using Expected::moveInto() to extract the value instead instead. --- clang/unittests/Basic/FileManagerTest.cpp | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'clang/unittests/Basic/FileManagerTest.cpp') diff --git a/clang/unittests/Basic/FileManagerTest.cpp b/clang/unittests/Basic/FileManagerTest.cpp index b40ba01..a122747 100644 --- a/clang/unittests/Basic/FileManagerTest.cpp +++ b/clang/unittests/Basic/FileManagerTest.cpp @@ -12,6 +12,7 @@ #include "llvm/ADT/STLExtras.h" #include "llvm/Support/Path.h" #include "llvm/Support/VirtualFileSystem.h" +#include "llvm/Testing/Support/Error.h" #include "gtest/gtest.h" using namespace llvm; @@ -559,9 +560,10 @@ TEST_F(FileManagerTest, getBypassFile) { // Calling a second time should not affect the UID or size. unsigned VirtualUID = FE.getUID(); - EXPECT_EQ( - &FE, - &expectedToOptional(Manager.getFileRef("/tmp/test"))->getFileEntry()); + llvm::Optional SearchRef; + ASSERT_THAT_ERROR(Manager.getFileRef("/tmp/test").moveInto(SearchRef), + Succeeded()); + EXPECT_EQ(&FE, &SearchRef->getFileEntry()); EXPECT_EQ(FE.getUID(), VirtualUID); EXPECT_EQ(FE.getSize(), 10); @@ -578,9 +580,9 @@ TEST_F(FileManagerTest, getBypassFile) { EXPECT_NE(BypassRef->getSize(), FE.getSize()); // The virtual file should still be returned when searching. - EXPECT_EQ( - &FE, - &expectedToOptional(Manager.getFileRef("/tmp/test"))->getFileEntry()); + ASSERT_THAT_ERROR(Manager.getFileRef("/tmp/test").moveInto(SearchRef), + Succeeded()); + EXPECT_EQ(&FE, &SearchRef->getFileEntry()); } } // anonymous namespace -- cgit v1.1