[clang] 852db8e - clang/unittests/Basic/SarifTest.cpp: std::optional::value => operator*

Fangrui Song via cfe-commits cfe-commits at lists.llvm.org
Fri Dec 16 18:08:31 PST 2022


Author: Fangrui Song
Date: 2022-12-17T02:08:24Z
New Revision: 852db8e97ef79db451072c4e3261c3116a4f01b6

URL: https://github.com/llvm/llvm-project/commit/852db8e97ef79db451072c4e3261c3116a4f01b6
DIFF: https://github.com/llvm/llvm-project/commit/852db8e97ef79db451072c4e3261c3116a4f01b6.diff

LOG: clang/unittests/Basic/SarifTest.cpp: std::optional::value => operator*

Added: 
    

Modified: 
    clang/unittests/Basic/SarifTest.cpp

Removed: 
    


################################################################################
diff  --git a/clang/unittests/Basic/SarifTest.cpp b/clang/unittests/Basic/SarifTest.cpp
index 9bbed582f50b6..06ad4e7a63091 100644
--- a/clang/unittests/Basic/SarifTest.cpp
+++ b/clang/unittests/Basic/SarifTest.cpp
@@ -120,9 +120,9 @@ TEST_F(SarifDocumentWriterTest, canCreateDocumentWithOneRun) {
   ASSERT_TRUE(Driver->getString("fullName").has_value());
   ASSERT_TRUE(Driver->getString("language").has_value());
 
-  EXPECT_EQ(Driver->getString("name").value(), ShortName);
-  EXPECT_EQ(Driver->getString("fullName").value(), LongName);
-  EXPECT_EQ(Driver->getString("language").value(), "en-US");
+  EXPECT_EQ(*Driver->getString("name"), ShortName);
+  EXPECT_EQ(*Driver->getString("fullName"), LongName);
+  EXPECT_EQ(*Driver->getString("language"), "en-US");
 }
 
 TEST_F(SarifDocumentWriterTest, addingResultsWillCrashIfThereIsNoRun) {
@@ -229,8 +229,8 @@ TEST_F(SarifDocumentWriterTest, addingResultWithValidRuleAndRunIsOk) {
   ASSERT_TRUE(Driver->getString("name").has_value());
   ASSERT_TRUE(Driver->getString("fullName").has_value());
 
-  EXPECT_EQ(Driver->getString("name").value(), "sarif test");
-  EXPECT_EQ(Driver->getString("fullName").value(), "sarif test runner");
+  EXPECT_EQ(*Driver->getString("name"), "sarif test");
+  EXPECT_EQ(*Driver->getString("fullName"), "sarif test runner");
 
   // The results are as expected
   EXPECT_EQ(Results->size(), 1UL);


        


More information about the cfe-commits mailing list