diff options
author | Duncan P. N. Exon Smith <dexonsmith@apple.com> | 2021-10-25 13:37:45 -0700 |
---|---|---|
committer | Duncan P. N. Exon Smith <dexonsmith@apple.com> | 2021-10-25 13:44:45 -0700 |
commit | da47ec3ca076477b994a5fdd7b777aed9b8cbdf4 (patch) | |
tree | 0ed728369a944b1dcc34e9d7a2a5329f8cd72441 /clang/unittests/Basic/FileManagerTest.cpp | |
parent | 3a995c918e8e21ae6fd94f761851b620fbafaf19 (diff) | |
download | llvm-da47ec3ca076477b994a5fdd7b777aed9b8cbdf4.zip llvm-da47ec3ca076477b994a5fdd7b777aed9b8cbdf4.tar.gz llvm-da47ec3ca076477b994a5fdd7b777aed9b8cbdf4.tar.bz2 |
Basic: Stop using expectedToOptional() in FileManagerTest, NFC
Remove a couple of uses of expectedToOptional() in FileManagerTest,
using Expected<T>::moveInto() to extract the value instead instead.
Diffstat (limited to 'clang/unittests/Basic/FileManagerTest.cpp')
-rw-r--r-- | clang/unittests/Basic/FileManagerTest.cpp | 14 |
1 files changed, 8 insertions, 6 deletions
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<FileEntryRef> 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 |