mirror of
https://github.com/XRPLF/clio.git
synced 2025-12-03 18:15:51 +00:00
style: Mark JSON literal strings with R"JSON (#2169)
This commit is contained in:
@@ -71,7 +71,7 @@ struct SubscriptionSourceConnectionTestsBase : SyncAsioContextTest {
|
||||
ASSERT_TRUE(message);
|
||||
EXPECT_EQ(
|
||||
message.value(),
|
||||
R"({"command":"subscribe","streams":["ledger","manifests","validations","transactions_proposed"]})"
|
||||
R"JSON({"command":"subscribe","streams":["ledger","manifests","validations","transactions_proposed"]})JSON"
|
||||
);
|
||||
}();
|
||||
return std::move(connection).value();
|
||||
@@ -199,7 +199,7 @@ TEST_F(SubscriptionSourceReadTests, GotWrongMessage_Reconnect)
|
||||
TEST_F(SubscriptionSourceReadTests, GotResult)
|
||||
{
|
||||
boost::asio::spawn(ctx_, [this](boost::asio::yield_context yield) {
|
||||
auto connection = connectAndSendMessage(R"({"result":{})", yield);
|
||||
auto connection = connectAndSendMessage(R"JSON({"result":{})JSON", yield);
|
||||
connection.close(yield);
|
||||
});
|
||||
|
||||
@@ -211,7 +211,7 @@ TEST_F(SubscriptionSourceReadTests, GotResult)
|
||||
TEST_F(SubscriptionSourceReadTests, GotResultWithLedgerIndex)
|
||||
{
|
||||
boost::asio::spawn(ctx_, [this](boost::asio::yield_context yield) {
|
||||
auto connection = connectAndSendMessage(R"({"result":{"ledger_index":123}})", yield);
|
||||
auto connection = connectAndSendMessage(R"JSON({"result":{"ledger_index":123}})JSON", yield);
|
||||
connection.close(yield);
|
||||
});
|
||||
|
||||
@@ -224,7 +224,7 @@ TEST_F(SubscriptionSourceReadTests, GotResultWithLedgerIndex)
|
||||
TEST_F(SubscriptionSourceReadTests, GotResultWithLedgerIndexAsString_Reconnect)
|
||||
{
|
||||
boost::asio::spawn(ctx_, [this](boost::asio::yield_context yield) {
|
||||
auto connection = connectAndSendMessage(R"({"result":{"ledger_index":"123"}})", yield);
|
||||
auto connection = connectAndSendMessage(R"JSON({"result":{"ledger_index":"123"}})JSON", yield);
|
||||
// We have to schedule receiving to receive close frame and boost will handle it automatically
|
||||
connection.receive(yield);
|
||||
serverConnection(yield);
|
||||
@@ -238,7 +238,7 @@ TEST_F(SubscriptionSourceReadTests, GotResultWithLedgerIndexAsString_Reconnect)
|
||||
TEST_F(SubscriptionSourceReadTests, GotResultWithValidatedLedgersAsNumber_Reconnect)
|
||||
{
|
||||
boost::asio::spawn(ctx_, [this](boost::asio::yield_context yield) {
|
||||
auto connection = connectAndSendMessage(R"({"result":{"validated_ledgers":123}})", yield);
|
||||
auto connection = connectAndSendMessage(R"JSON({"result":{"validated_ledgers":123}})JSON", yield);
|
||||
// We have to schedule receiving to receive close frame and boost will handle it automatically
|
||||
connection.receive(yield);
|
||||
serverConnection(yield);
|
||||
@@ -262,7 +262,7 @@ TEST_F(SubscriptionSourceReadTests, GotResultWithValidatedLedgers)
|
||||
EXPECT_FALSE(subscriptionSource_.hasLedger(790));
|
||||
|
||||
boost::asio::spawn(ctx_, [this](boost::asio::yield_context yield) {
|
||||
auto connection = connectAndSendMessage(R"({"result":{"validated_ledgers":"123-456,789,32"}})", yield);
|
||||
auto connection = connectAndSendMessage(R"JSON({"result":{"validated_ledgers":"123-456,789,32"}})JSON", yield);
|
||||
connection.close(yield);
|
||||
});
|
||||
|
||||
@@ -286,7 +286,7 @@ TEST_F(SubscriptionSourceReadTests, GotResultWithValidatedLedgers)
|
||||
TEST_F(SubscriptionSourceReadTests, GotResultWithValidatedLedgersWrongValue_Reconnect)
|
||||
{
|
||||
boost::asio::spawn(ctx_, [this](boost::asio::yield_context yield) {
|
||||
auto connection = connectAndSendMessage(R"({"result":{"validated_ledgers":"123-456-789,32"}})", yield);
|
||||
auto connection = connectAndSendMessage(R"JSON({"result":{"validated_ledgers":"123-456-789,32"}})JSON", yield);
|
||||
// We have to schedule receiving to receive close frame and boost will handle it automatically
|
||||
connection.receive(yield);
|
||||
serverConnection(yield);
|
||||
@@ -306,7 +306,8 @@ TEST_F(SubscriptionSourceReadTests, GotResultWithLedgerIndexAndValidatedLedgers)
|
||||
EXPECT_FALSE(subscriptionSource_.hasLedger(4));
|
||||
|
||||
boost::asio::spawn(ctx_, [this](boost::asio::yield_context yield) {
|
||||
auto connection = connectAndSendMessage(R"({"result":{"ledger_index":123,"validated_ledgers":"1-3"}})", yield);
|
||||
auto connection =
|
||||
connectAndSendMessage(R"JSON({"result":{"ledger_index":123,"validated_ledgers":"1-3"}})JSON", yield);
|
||||
connection.close(yield);
|
||||
});
|
||||
|
||||
@@ -326,7 +327,7 @@ TEST_F(SubscriptionSourceReadTests, GotResultWithLedgerIndexAndValidatedLedgers)
|
||||
TEST_F(SubscriptionSourceReadTests, GotLedgerClosed)
|
||||
{
|
||||
boost::asio::spawn(ctx_, [this](boost::asio::yield_context yield) {
|
||||
auto connection = connectAndSendMessage(R"({"type":"ledgerClosed"})", yield);
|
||||
auto connection = connectAndSendMessage(R"JSON({"type":"ledgerClosed"})JSON", yield);
|
||||
connection.close(yield);
|
||||
});
|
||||
|
||||
@@ -340,7 +341,7 @@ TEST_F(SubscriptionSourceReadTests, GotLedgerClosedForwardingIsSet)
|
||||
subscriptionSource_.setForwarding(true);
|
||||
|
||||
boost::asio::spawn(ctx_, [this](boost::asio::yield_context yield) {
|
||||
auto connection = connectAndSendMessage(R"({"type": "ledgerClosed"})", yield);
|
||||
auto connection = connectAndSendMessage(R"JSON({"type": "ledgerClosed"})JSON", yield);
|
||||
connection.close(yield);
|
||||
});
|
||||
|
||||
@@ -356,7 +357,7 @@ TEST_F(SubscriptionSourceReadTests, GotLedgerClosedForwardingIsSet)
|
||||
TEST_F(SubscriptionSourceReadTests, GotLedgerClosedWithLedgerIndex)
|
||||
{
|
||||
boost::asio::spawn(ctx_, [this](boost::asio::yield_context yield) {
|
||||
auto connection = connectAndSendMessage(R"({"type": "ledgerClosed","ledger_index": 123})", yield);
|
||||
auto connection = connectAndSendMessage(R"JSON({"type": "ledgerClosed","ledger_index": 123})JSON", yield);
|
||||
connection.close(yield);
|
||||
});
|
||||
|
||||
@@ -369,7 +370,7 @@ TEST_F(SubscriptionSourceReadTests, GotLedgerClosedWithLedgerIndex)
|
||||
TEST_F(SubscriptionSourceReadTests, GotLedgerClosedWithLedgerIndexAsString_Reconnect)
|
||||
{
|
||||
boost::asio::spawn(ctx_, [this](boost::asio::yield_context yield) {
|
||||
auto connection = connectAndSendMessage(R"({"type":"ledgerClosed","ledger_index":"123"}})", yield);
|
||||
auto connection = connectAndSendMessage(R"JSON({"type":"ledgerClosed","ledger_index":"123"}})JSON", yield);
|
||||
// We have to schedule receiving to receive close frame and boost will handle it automatically
|
||||
connection.receive(yield);
|
||||
serverConnection(yield);
|
||||
@@ -383,7 +384,7 @@ TEST_F(SubscriptionSourceReadTests, GotLedgerClosedWithLedgerIndexAsString_Recon
|
||||
TEST_F(SubscriptionSourceReadTests, GorLedgerClosedWithValidatedLedgersAsNumber_Reconnect)
|
||||
{
|
||||
boost::asio::spawn(ctx_, [this](boost::asio::yield_context yield) {
|
||||
auto connection = connectAndSendMessage(R"({"type":"ledgerClosed","validated_ledgers":123})", yield);
|
||||
auto connection = connectAndSendMessage(R"JSON({"type":"ledgerClosed","validated_ledgers":123})JSON", yield);
|
||||
// We have to schedule receiving to receive close frame and boost will handle it automatically
|
||||
connection.receive(yield);
|
||||
serverConnection(yield);
|
||||
@@ -402,7 +403,7 @@ TEST_F(SubscriptionSourceReadTests, GotLedgerClosedWithValidatedLedgers)
|
||||
EXPECT_FALSE(subscriptionSource_.hasLedger(3));
|
||||
|
||||
boost::asio::spawn(ctx_, [this](boost::asio::yield_context yield) {
|
||||
auto connection = connectAndSendMessage(R"({"type":"ledgerClosed","validated_ledgers":"1-2"})", yield);
|
||||
auto connection = connectAndSendMessage(R"JSON({"type":"ledgerClosed","validated_ledgers":"1-2"})JSON", yield);
|
||||
connection.close(yield);
|
||||
});
|
||||
|
||||
@@ -425,8 +426,9 @@ TEST_F(SubscriptionSourceReadTests, GotLedgerClosedWithLedgerIndexAndValidatedLe
|
||||
EXPECT_FALSE(subscriptionSource_.hasLedger(3));
|
||||
|
||||
boost::asio::spawn(ctx_, [this](boost::asio::yield_context yield) {
|
||||
auto connection =
|
||||
connectAndSendMessage(R"({"type":"ledgerClosed","ledger_index":123,"validated_ledgers":"1-2"})", yield);
|
||||
auto connection = connectAndSendMessage(
|
||||
R"JSON({"type":"ledgerClosed","ledger_index":123,"validated_ledgers":"1-2"})JSON", yield
|
||||
);
|
||||
connection.close(yield);
|
||||
});
|
||||
|
||||
@@ -445,7 +447,7 @@ TEST_F(SubscriptionSourceReadTests, GotLedgerClosedWithLedgerIndexAndValidatedLe
|
||||
TEST_F(SubscriptionSourceReadTests, GotTransactionIsForwardingFalse)
|
||||
{
|
||||
boost::asio::spawn(ctx_, [this](boost::asio::yield_context yield) {
|
||||
auto connection = connectAndSendMessage(R"({"transaction":"some_transaction_data"})", yield);
|
||||
auto connection = connectAndSendMessage(R"JSON({"transaction":"some_transaction_data"})JSON", yield);
|
||||
connection.close(yield);
|
||||
});
|
||||
|
||||
@@ -489,7 +491,7 @@ TEST_F(SubscriptionSourceReadTests, GotTransactionWithMetaIsForwardingFalse)
|
||||
TEST_F(SubscriptionSourceReadTests, GotValidationReceivedIsForwardingFalse)
|
||||
{
|
||||
boost::asio::spawn(ctx_, [this](boost::asio::yield_context yield) {
|
||||
auto connection = connectAndSendMessage(R"({"type":"validationReceived"})", yield);
|
||||
auto connection = connectAndSendMessage(R"JSON({"type":"validationReceived"})JSON", yield);
|
||||
connection.close(yield);
|
||||
});
|
||||
|
||||
@@ -517,7 +519,7 @@ TEST_F(SubscriptionSourceReadTests, GotValidationReceivedIsForwardingTrue)
|
||||
TEST_F(SubscriptionSourceReadTests, GotManiefstReceivedIsForwardingFalse)
|
||||
{
|
||||
boost::asio::spawn(ctx_, [this](boost::asio::yield_context yield) {
|
||||
auto connection = connectAndSendMessage(R"({"type":"manifestReceived"})", yield);
|
||||
auto connection = connectAndSendMessage(R"JSON({"type":"manifestReceived"})JSON", yield);
|
||||
connection.close(yield);
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user