diff --git a/packages/react-native/ReactCommon/jsinspector-modern/tests/InspectorPackagerConnectionTest.cpp b/packages/react-native/ReactCommon/jsinspector-modern/tests/InspectorPackagerConnectionTest.cpp index e0ed7fcdacb..878f5356f30 100644 --- a/packages/react-native/ReactCommon/jsinspector-modern/tests/InspectorPackagerConnectionTest.cpp +++ b/packages/react-native/ReactCommon/jsinspector-modern/tests/InspectorPackagerConnectionTest.cpp @@ -16,6 +16,7 @@ #include #include +#include #include #include "FollyDynamicMatchers.h" @@ -25,7 +26,7 @@ using namespace ::testing; using namespace std::literals::chrono_literals; using namespace std::literals::string_literals; -using folly::dynamic, folly::toJson, folly::sformat; +using folly::dynamic, folly::toJson; namespace facebook::react::jsinspector_modern { @@ -281,7 +282,7 @@ TEST_F(InspectorPackagerConnectionTest, TestSendReceiveEvents) { .lazily_make_unique>()); // Connect to the page. - webSockets_[0]->getDelegate().didReceiveMessage(sformat( + webSockets_[0]->getDelegate().didReceiveMessage(std::format( R"({{ "event": "connect", "payload": {{ @@ -321,7 +322,7 @@ TEST_F(InspectorPackagerConnectionTest, TestSendReceiveEvents) { AtJsonPtr("/params", ElementsAre("arg1", "arg2")))))) .RetiresOnSaturation(); - webSockets_[0]->getDelegate().didReceiveMessage(sformat( + webSockets_[0]->getDelegate().didReceiveMessage(std::format( R"({{ "event": "wrappedEvent", "payload": {{ @@ -373,7 +374,7 @@ TEST_F(InspectorPackagerConnectionTest, TestSendReceiveEventsToMultiplePages) { for (int i = 0; i < kNumPages; ++i) { // Connect to the i-th page. - webSockets_[0]->getDelegate().didReceiveMessage(sformat( + webSockets_[0]->getDelegate().didReceiveMessage(std::format( R"({{ "event": "connect", "payload": {{ @@ -415,7 +416,7 @@ TEST_F(InspectorPackagerConnectionTest, TestSendReceiveEventsToMultiplePages) { *localConnections_[i], sendMessage(JsonParsed(AtJsonPtr("/method", Eq(method))))) .RetiresOnSaturation(); - webSockets_[0]->getDelegate().didReceiveMessage(sformat( + webSockets_[0]->getDelegate().didReceiveMessage(std::format( R"({{ "event": "wrappedEvent", "payload": {{ @@ -445,7 +446,7 @@ TEST_F(InspectorPackagerConnectionTest, TestSendEventToAllConnections) { .lazily_make_unique>()); // Connect to the page. - webSockets_[0]->getDelegate().didReceiveMessage(sformat( + webSockets_[0]->getDelegate().didReceiveMessage(std::format( R"({{ "event": "connect", "payload": {{ @@ -486,7 +487,7 @@ TEST_F(InspectorPackagerConnectionTest, TestConnectThenDisconnect) { .lazily_make_unique>()); // Connect to the page. - webSockets_[0]->getDelegate().didReceiveMessage(sformat( + webSockets_[0]->getDelegate().didReceiveMessage(std::format( R"({{ "event": "connect", "payload": {{ @@ -498,7 +499,7 @@ TEST_F(InspectorPackagerConnectionTest, TestConnectThenDisconnect) { // Disconnect from the page. EXPECT_CALL(*localConnections_[0], disconnect()).RetiresOnSaturation(); - webSockets_[0]->getDelegate().didReceiveMessage(sformat( + webSockets_[0]->getDelegate().didReceiveMessage(std::format( R"({{ "event": "disconnect", "payload": {{ @@ -521,7 +522,7 @@ TEST_F(InspectorPackagerConnectionTest, TestConnectThenCloseSocket) { .lazily_make_unique>()); // Connect to the page. - webSockets_[0]->getDelegate().didReceiveMessage(sformat( + webSockets_[0]->getDelegate().didReceiveMessage(std::format( R"({{ "event": "connect", "payload": {{ @@ -549,7 +550,7 @@ TEST_F(InspectorPackagerConnectionTest, TestConnectThenSocketFailure) { .lazily_make_unique>()); // Connect to the page. - webSockets_[0]->getDelegate().didReceiveMessage(sformat( + webSockets_[0]->getDelegate().didReceiveMessage(std::format( R"({{ "event": "connect", "payload": {{ @@ -579,7 +580,7 @@ TEST_F( .lazily_make_unique>()); // Connect to the page. - webSockets_[0]->getDelegate().didReceiveMessage(sformat( + webSockets_[0]->getDelegate().didReceiveMessage(std::format( R"({{ "event": "connect", "payload": {{ @@ -625,7 +626,7 @@ TEST_F( .lazily_make_unique>()); // Connect to the page. - webSockets_[0]->getDelegate().didReceiveMessage(sformat( + webSockets_[0]->getDelegate().didReceiveMessage(std::format( R"({{ "event": "connect", "payload": {{ @@ -637,7 +638,7 @@ TEST_F( // Try connecting to the same page again. This results in a disconnection. EXPECT_CALL(*localConnections_[0], disconnect()).RetiresOnSaturation(); - webSockets_[0]->getDelegate().didReceiveMessage(sformat( + webSockets_[0]->getDelegate().didReceiveMessage(std::format( R"({{ "event": "connect", "payload": {{ @@ -660,7 +661,7 @@ TEST_F(InspectorPackagerConnectionTest, TestMultipleDisconnect) { .lazily_make_unique>()); // Connect to the page. - webSockets_[0]->getDelegate().didReceiveMessage(sformat( + webSockets_[0]->getDelegate().didReceiveMessage(std::format( R"({{ "event": "connect", "payload": {{ @@ -672,7 +673,7 @@ TEST_F(InspectorPackagerConnectionTest, TestMultipleDisconnect) { // Disconnect from the page. EXPECT_CALL(*localConnections_[0], disconnect()).RetiresOnSaturation(); - webSockets_[0]->getDelegate().didReceiveMessage(sformat( + webSockets_[0]->getDelegate().didReceiveMessage(std::format( R"({{ "event": "disconnect", "payload": {{ @@ -683,7 +684,7 @@ TEST_F(InspectorPackagerConnectionTest, TestMultipleDisconnect) { EXPECT_FALSE(localConnections_[0]); // Disconnect again. This is a noop. - webSockets_[0]->getDelegate().didReceiveMessage(sformat( + webSockets_[0]->getDelegate().didReceiveMessage(std::format( R"({{ "event": "disconnect", "payload": {{ @@ -706,7 +707,7 @@ TEST_F(InspectorPackagerConnectionTest, TestDisconnectThenSendEvent) { .lazily_make_unique>()); // Connect to the page. - webSockets_[0]->getDelegate().didReceiveMessage(sformat( + webSockets_[0]->getDelegate().didReceiveMessage(std::format( R"({{ "event": "connect", "payload": {{ @@ -718,7 +719,7 @@ TEST_F(InspectorPackagerConnectionTest, TestDisconnectThenSendEvent) { // Disconnect from the page. EXPECT_CALL(*localConnections_[0], disconnect()).RetiresOnSaturation(); - webSockets_[0]->getDelegate().didReceiveMessage(sformat( + webSockets_[0]->getDelegate().didReceiveMessage(std::format( R"({{ "event": "disconnect", "payload": {{ @@ -730,7 +731,7 @@ TEST_F(InspectorPackagerConnectionTest, TestDisconnectThenSendEvent) { // Send an event from the frontend (remote) to the backend (local). This // is a noop. - webSockets_[0]->getDelegate().didReceiveMessage(sformat( + webSockets_[0]->getDelegate().didReceiveMessage(std::format( R"({{ "event": "wrappedEvent", "payload": {{ @@ -754,7 +755,7 @@ TEST_F(InspectorPackagerConnectionTest, TestSendEventToUnknownPage) { // Send an event from the frontend (remote) to the backend (local). This // is a noop (except for logging). - webSockets_[0]->getDelegate().didReceiveMessage(sformat( + webSockets_[0]->getDelegate().didReceiveMessage(std::format( R"({{ "event": "wrappedEvent", "payload": {{ @@ -921,7 +922,7 @@ TEST_F( .lazily_make_unique>()); // Connect to the page. - retainedWebSocketDelegate->didReceiveMessage(sformat( + retainedWebSocketDelegate->didReceiveMessage(std::format( R"({{ "event": "connect", "payload": {{ @@ -941,7 +942,7 @@ TEST_F( AtJsonPtr("/params", ElementsAre("arg1", "arg2")))))) .RetiresOnSaturation(); - retainedWebSocketDelegate->didReceiveMessage(sformat( + retainedWebSocketDelegate->didReceiveMessage(std::format( R"({{ "event": "wrappedEvent", "payload": {{ @@ -975,7 +976,7 @@ TEST_F(InspectorPackagerConnectionTest, TestDestroyConnectionOnPageRemoved) { .lazily_make_unique>()); // Connect to the page. - webSockets_[0]->getDelegate().didReceiveMessage(sformat( + webSockets_[0]->getDelegate().didReceiveMessage(std::format( R"({{ "event": "connect", "payload": {{ @@ -1005,7 +1006,7 @@ TEST_F( .lazily_make_unique>()); // Connect to the page. - webSockets_[0]->getDelegate().didReceiveMessage(sformat( + webSockets_[0]->getDelegate().didReceiveMessage(std::format( R"({{ "event": "connect", "payload": {{ @@ -1045,7 +1046,7 @@ TEST_F( .lazily_make_unique>()); // Connect to the page. - webSockets_[0]->getDelegate().didReceiveMessage(sformat( + webSockets_[0]->getDelegate().didReceiveMessage(std::format( R"({{ "event": "connect", "payload": {{ @@ -1064,7 +1065,7 @@ TEST_F( // Disconnect from the page. EXPECT_CALL(*localConnections_[0], disconnect()).RetiresOnSaturation(); - webSockets_[0]->getDelegate().didReceiveMessage(sformat( + webSockets_[0]->getDelegate().didReceiveMessage(std::format( R"({{ "event": "disconnect", "payload": {{ @@ -1075,7 +1076,7 @@ TEST_F( EXPECT_FALSE(localConnections_[0]); // Connect to the same page again. - webSockets_[0]->getDelegate().didReceiveMessage(sformat( + webSockets_[0]->getDelegate().didReceiveMessage(std::format( R"({{ "event": "connect", "payload": {{ @@ -1127,7 +1128,7 @@ TEST_F( .lazily_make_unique>()); // Connect to the page. - webSockets_[0]->getDelegate().didReceiveMessage(sformat( + webSockets_[0]->getDelegate().didReceiveMessage(std::format( R"({{ "event": "connect", "payload": {{ @@ -1151,7 +1152,7 @@ TEST_F( // Disconnect from the page. EXPECT_CALL(*localConnections_[0], disconnect()).RetiresOnSaturation(); - webSockets_[0]->getDelegate().didReceiveMessage(sformat( + webSockets_[0]->getDelegate().didReceiveMessage(std::format( R"({{ "event": "disconnect", "payload": {{ @@ -1162,7 +1163,7 @@ TEST_F( EXPECT_FALSE(localConnections_[0]); // Connect to the same page again. - webSockets_[0]->getDelegate().didReceiveMessage(sformat( + webSockets_[0]->getDelegate().didReceiveMessage(std::format( R"({{ "event": "connect", "payload": {{ @@ -1256,7 +1257,7 @@ TEST_F(InspectorPackagerConnectionTest, TestRejectedPageConnection) { AtJsonPtr("/payload/pageId", Eq(std::to_string(pageId))))))) .RetiresOnSaturation(); - webSockets_[0]->getDelegate().didReceiveMessage(sformat( + webSockets_[0]->getDelegate().didReceiveMessage(std::format( R"({{ "event": "connect", "payload": {{ @@ -1265,7 +1266,7 @@ TEST_F(InspectorPackagerConnectionTest, TestRejectedPageConnection) { }})", toJson(std::to_string(pageId)))); - webSockets_[0]->getDelegate().didReceiveMessage(sformat( + webSockets_[0]->getDelegate().didReceiveMessage(std::format( R"({{ "event": "wrappedEvent", "payload": {{ @@ -1291,7 +1292,7 @@ TEST_F(InspectorPackagerConnectionTest, TestRejectedPageConnection) { AtJsonPtr("/payload/pageId", Eq(std::to_string(pageId))))))) .RetiresOnSaturation(); - webSockets_[0]->getDelegate().didReceiveMessage(sformat( + webSockets_[0]->getDelegate().didReceiveMessage(std::format( R"({{ "event": "connect", "payload": {{ @@ -1300,7 +1301,7 @@ TEST_F(InspectorPackagerConnectionTest, TestRejectedPageConnection) { }})", toJson(std::to_string(pageId)))); - webSockets_[0]->getDelegate().didReceiveMessage(sformat( + webSockets_[0]->getDelegate().didReceiveMessage(std::format( R"({{ "event": "wrappedEvent", "payload": {{ @@ -1319,7 +1320,7 @@ TEST_F(InspectorPackagerConnectionTest, TestRejectedPageConnection) { // page. mockNextConnectionBehavior = Accept; - webSockets_[0]->getDelegate().didReceiveMessage(sformat( + webSockets_[0]->getDelegate().didReceiveMessage(std::format( R"({{ "event": "connect", "payload": {{ @@ -1336,7 +1337,7 @@ TEST_F(InspectorPackagerConnectionTest, TestRejectedPageConnection) { AtJsonPtr("/params", ElementsAre("arg1", "arg2")))))) .RetiresOnSaturation(); - webSockets_[0]->getDelegate().didReceiveMessage(sformat( + webSockets_[0]->getDelegate().didReceiveMessage(std::format( R"({{ "event": "wrappedEvent", "payload": {{ diff --git a/packages/react-native/ReactCommon/jsinspector-modern/tests/JsiIntegrationTest.cpp b/packages/react-native/ReactCommon/jsinspector-modern/tests/JsiIntegrationTest.cpp index 6fe1605bf8c..3f34540e105 100644 --- a/packages/react-native/ReactCommon/jsinspector-modern/tests/JsiIntegrationTest.cpp +++ b/packages/react-native/ReactCommon/jsinspector-modern/tests/JsiIntegrationTest.cpp @@ -8,13 +8,13 @@ #include #include #include +#include #include "JsiIntegrationTest.h" #include "engines/JsiIntegrationTestGenericEngineAdapter.h" #include "engines/JsiIntegrationTestHermesEngineAdapter.h" using namespace ::testing; -using folly::sformat; namespace facebook::react::jsinspector_modern { @@ -486,7 +486,7 @@ TYPED_TEST(JsiIntegrationHermesTest, EvaluateExpressionInExecutionContext) { } } })")); - this->toPage_->sendMessage(sformat( + this->toPage_->sendMessage(std::format( R"({{ "id": 1, "method": "Runtime.evaluate", @@ -508,7 +508,7 @@ TYPED_TEST(JsiIntegrationHermesTest, EvaluateExpressionInExecutionContext) { // Now the old execution context is stale. this->expectMessageFromPage( JsonParsed(AllOf(AtJsonPtr("/id", 3), AtJsonPtr("/error/code", -32600)))); - this->toPage_->sendMessage(sformat( + this->toPage_->sendMessage(std::format( R"({{ "id": 3, "method": "Runtime.evaluate", @@ -731,7 +731,7 @@ TYPED_TEST(JsiIntegrationHermesTest, ReleaseRemoteObject) { // Ensure we can get the properties of the object. this->expectMessageFromPage(JsonParsed( AllOf(AtJsonPtr("/id", 2), AtJsonPtr("/result/result", SizeIs(Gt(0)))))); - this->toPage_->sendMessage(sformat( + this->toPage_->sendMessage(std::format( R"({{ "id": 2, "method": "Runtime.getProperties", @@ -744,7 +744,7 @@ TYPED_TEST(JsiIntegrationHermesTest, ReleaseRemoteObject) { "id": 3, "result": {} })")); - this->toPage_->sendMessage(sformat( + this->toPage_->sendMessage(std::format( R"({{ "id": 3, "method": "Runtime.releaseObject", @@ -755,7 +755,7 @@ TYPED_TEST(JsiIntegrationHermesTest, ReleaseRemoteObject) { // Getting properties for a released object results in an error. this->expectMessageFromPage( JsonParsed(AllOf(AtJsonPtr("/id", 4), AtJsonPtr("/error/code", -32000)))); - this->toPage_->sendMessage(sformat( + this->toPage_->sendMessage(std::format( R"({{ "id": 4, "method": "Runtime.getProperties", @@ -766,7 +766,7 @@ TYPED_TEST(JsiIntegrationHermesTest, ReleaseRemoteObject) { // Releasing an already released object is an error. this->expectMessageFromPage( JsonParsed(AllOf(AtJsonPtr("/id", 5), AtJsonPtr("/error/code", -32000)))); - this->toPage_->sendMessage(sformat( + this->toPage_->sendMessage(std::format( R"({{ "id": 5, "method": "Runtime.releaseObject", @@ -797,7 +797,7 @@ TYPED_TEST(JsiIntegrationHermesTest, ReleaseRemoteObjectGroup) { // Ensure we can get the properties of the object. this->expectMessageFromPage(JsonParsed( AllOf(AtJsonPtr("/id", 2), AtJsonPtr("/result/result", SizeIs(Gt(0)))))); - this->toPage_->sendMessage(sformat( + this->toPage_->sendMessage(std::format( R"({{ "id": 2, "method": "Runtime.getProperties", @@ -819,7 +819,7 @@ TYPED_TEST(JsiIntegrationHermesTest, ReleaseRemoteObjectGroup) { // Getting properties for a released object results in an error. this->expectMessageFromPage( JsonParsed(AllOf(AtJsonPtr("/id", 4), AtJsonPtr("/error/code", -32000)))); - this->toPage_->sendMessage(sformat( + this->toPage_->sendMessage(std::format( R"({{ "id": 4, "method": "Runtime.getProperties", diff --git a/private/react-native-fantom/tester/src/main.cpp b/private/react-native-fantom/tester/src/main.cpp index 58754619a9d..789f93ba02b 100644 --- a/private/react-native-fantom/tester/src/main.cpp +++ b/private/react-native-fantom/tester/src/main.cpp @@ -5,10 +5,10 @@ * LICENSE file in the root directory of this source tree. */ -#include #include #include #include +#include #include int main() { @@ -17,7 +17,7 @@ int main() { LOG(INFO) << "Hello, I am fantom_tester using glog!"; - LOG(INFO) << fmt::format( + LOG(INFO) << std::format( "[Yoga] undefined == zero: {}", YGValueZero == YGValueUndefined); return 0;