Title: [293709] trunk/Tools/TestWebKitAPI/Tests/WTF/Ref.cpp
Revision
293709
Author
cdu...@apple.com
Date
2022-05-02 19:08:46 -0700 (Mon, 02 May 2022)

Log Message

Add API tests for ref-counting churn in static_reference_cast<>()
https://bugs.webkit.org/show_bug.cgi?id=239987

Reviewed by Darin Adler.

Add API tests for ref-counting churn in static_reference_cast<>().
This covers the fix made in r293682.

* Tools/TestWebKitAPI/Tests/WTF/Ref.cpp:
(TestWebKitAPI::TEST):

Canonical link: https://commits.webkit.org/250198@main

Modified Paths

Diff

Modified: trunk/Tools/TestWebKitAPI/Tests/WTF/Ref.cpp (293708 => 293709)


--- trunk/Tools/TestWebKitAPI/Tests/WTF/Ref.cpp	2022-05-03 01:55:37 UTC (rev 293708)
+++ trunk/Tools/TestWebKitAPI/Tests/WTF/Ref.cpp	2022-05-03 02:08:46 UTC (rev 293709)
@@ -272,4 +272,20 @@
     EXPECT_STREQ("ref(a) | slot=c deref(a) | deref(c) ", takeLogStr().c_str());
 }
 
+TEST(WTF_Ref, StaticReferenceCastFromConstReference)
+{
+    DerivedRefCheckingRefLogger a("a");
+    const Ref<DerivedRefCheckingRefLogger> ref(a);
+    auto ref2 = static_reference_cast<RefCheckingRefLogger>(ref);
+    EXPECT_STREQ("ref(a) ref(a) ", takeLogStr().c_str());
+}
+
+TEST(WTF_Ref, StaticReferenceCastFromRValueReference)
+{
+    DerivedRefCheckingRefLogger a("a");
+    Ref<DerivedRefCheckingRefLogger> ref(a);
+    auto ref2 = static_reference_cast<RefCheckingRefLogger>(WTFMove(ref));
+    EXPECT_STREQ("ref(a) ", takeLogStr().c_str());
+}
+
 } // namespace TestWebKitAPI
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to