@@ -1874,7 +1874,7 @@ JSONTEST_FIXTURE_LOCAL(ValueTest, CommentBefore) {
18741874 Json::String result = Json::writeString (wbuilder, val);
18751875 JSONTEST_ASSERT_STRING_EQUAL (expected, result);
18761876 Json::String res2 = val.toStyledString ();
1877- Json::String exp2 = " " ;
1877+ Json::String exp2;
18781878 exp2 += expected;
18791879 exp2 += " \n " ;
18801880 JSONTEST_ASSERT_STRING_EQUAL (exp2, res2);
@@ -2592,7 +2592,7 @@ JSONTEST_FIXTURE_LOCAL(StreamWriterTest, indentation) {
25922592JSONTEST_FIXTURE_LOCAL (StreamWriterTest, writeZeroes) {
25932593 Json::String binary (" hi" , 3 ); // include trailing 0
25942594 JSONTEST_ASSERT_EQUAL (3 , binary.length ());
2595- Json::String expected (" \ " hi\\ u0000\" " ); // unicoded zero
2595+ Json::String expected (R"( "hi\u0000" ) " ); // unicoded zero
25962596 Json::StreamWriterBuilder b;
25972597 {
25982598 Json::Value root;
@@ -2866,7 +2866,7 @@ JSONTEST_FIXTURE_LOCAL(CharReaderTest, parseWithNoErrors) {
28662866 CharReaderPtr reader (b.newCharReader ());
28672867 Json::String errs;
28682868 Json::Value root;
2869- char const doc[] = " { \ " property\ " : \ " value\ " }" ;
2869+ char const doc[] = R"( { "property" : "value" }) " ;
28702870 bool ok = reader->parse (doc, doc + std::strlen (doc), &root, &errs);
28712871 JSONTEST_ASSERT (ok);
28722872 JSONTEST_ASSERT (errs.empty ());
@@ -2914,14 +2914,14 @@ JSONTEST_FIXTURE_LOCAL(CharReaderTest, parseString) {
29142914 JSONTEST_ASSERT_EQUAL (" " , root[0 ]);
29152915 }
29162916 {
2917- char const doc[] = " [ \"\\ u8A2a\" ] " ;
2917+ char const doc[] = R"( ["\ u8A2a"] ) " ;
29182918 bool ok = reader->parse (doc, doc + std::strlen (doc), &root, &errs);
29192919 JSONTEST_ASSERT (ok);
29202920 JSONTEST_ASSERT (errs.empty ());
29212921 JSONTEST_ASSERT_EQUAL (u8" \u8A2a " , root[0 ].asString ()); // "訪"
29222922 }
29232923 {
2924- char const doc[] = " [ \"\\ uD801\ " ]" ;
2924+ char const doc[] = R"( [ "\ uD801" ]) " ;
29252925 bool ok = reader->parse (doc, doc + std::strlen (doc), &root, &errs);
29262926 JSONTEST_ASSERT (!ok);
29272927 JSONTEST_ASSERT (errs == " * Line 1, Column 3\n "
@@ -2930,7 +2930,7 @@ JSONTEST_FIXTURE_LOCAL(CharReaderTest, parseString) {
29302930 " See Line 1, Column 10 for detail.\n " );
29312931 }
29322932 {
2933- char const doc[] = " [ \"\\ uD801\\ d1234\ " ]" ;
2933+ char const doc[] = R"( [ "\ uD801\d1234" ]) " ;
29342934 bool ok = reader->parse (doc, doc + std::strlen (doc), &root, &errs);
29352935 JSONTEST_ASSERT (!ok);
29362936 JSONTEST_ASSERT (errs == " * Line 1, Column 3\n "
@@ -2939,7 +2939,7 @@ JSONTEST_FIXTURE_LOCAL(CharReaderTest, parseString) {
29392939 " See Line 1, Column 12 for detail.\n " );
29402940 }
29412941 {
2942- char const doc[] = " [ \"\\ ua3t@\ " ]" ;
2942+ char const doc[] = R"( [ "\ ua3t@" ]) " ;
29432943 bool ok = reader->parse (doc, doc + std::strlen (doc), &root, &errs);
29442944 JSONTEST_ASSERT (!ok);
29452945 JSONTEST_ASSERT (errs == " * Line 1, Column 3\n "
@@ -2948,7 +2948,7 @@ JSONTEST_FIXTURE_LOCAL(CharReaderTest, parseString) {
29482948 " See Line 1, Column 9 for detail.\n " );
29492949 }
29502950 {
2951- char const doc[] = " [ \"\\ ua3t\ " ]" ;
2951+ char const doc[] = R"( [ "\ ua3t" ]) " ;
29522952 bool ok = reader->parse (doc, doc + std::strlen (doc), &root, &errs);
29532953 JSONTEST_ASSERT (!ok);
29542954 JSONTEST_ASSERT (
@@ -2960,7 +2960,7 @@ JSONTEST_FIXTURE_LOCAL(CharReaderTest, parseString) {
29602960 {
29612961 b.settings_ [" allowSingleQuotes" ] = true ;
29622962 CharReaderPtr charreader (b.newCharReader ());
2963- char const doc[] = " {'a': 'x\\ ty', \" b \ " :'x\\\\ y'}" ;
2963+ char const doc[] = R"( {'a': 'x\ty', "b ":'x\\y'}) " ;
29642964 bool ok = charreader->parse (doc, doc + std::strlen (doc), &root, &errs);
29652965 JSONTEST_ASSERT (ok);
29662966 JSONTEST_ASSERT_STRING_EQUAL (" " , errs);
@@ -3007,15 +3007,15 @@ JSONTEST_FIXTURE_LOCAL(CharReaderTest, parseObjectWithErrors) {
30073007 Json::Value root;
30083008 Json::String errs;
30093009 {
3010- char const doc[] = " { \ " property\ " : \ " value\" " ;
3010+ char const doc[] = R"( { "property" : "value" ) " ;
30113011 bool ok = reader->parse (doc, doc + std::strlen (doc), &root, &errs);
30123012 JSONTEST_ASSERT (!ok);
30133013 JSONTEST_ASSERT (errs == " * Line 1, Column 24\n "
30143014 " Missing ',' or '}' in object declaration\n " );
30153015 JSONTEST_ASSERT_EQUAL (" value" , root[" property" ]);
30163016 }
30173017 {
3018- char const doc[] = " { \ " property\ " : \ " value\ " ," ;
3018+ char const doc[] = R"( { "property" : "value" ,) " ;
30193019 bool ok = reader->parse (doc, doc + std::strlen (doc), &root, &errs);
30203020 JSONTEST_ASSERT (!ok);
30213021 JSONTEST_ASSERT (errs == " * Line 1, Column 25\n "
@@ -3038,7 +3038,7 @@ JSONTEST_FIXTURE_LOCAL(CharReaderTest, parseArrayWithErrors) {
30383038 JSONTEST_ASSERT_EQUAL (" value" , root[0 ]);
30393039 }
30403040 {
3041- char const doc[] = " [ \ " value1\" \ " value2\ " ]" ;
3041+ char const doc[] = R"( [ "value1" "value2" ]) " ;
30423042 bool ok = reader->parse (doc, doc + std::strlen (doc), &root, &errs);
30433043 JSONTEST_ASSERT (!ok);
30443044 JSONTEST_ASSERT (errs == " * Line 1, Column 12\n "
@@ -3052,7 +3052,7 @@ JSONTEST_FIXTURE_LOCAL(CharReaderTest, parseWithOneError) {
30523052 CharReaderPtr reader (b.newCharReader ());
30533053 Json::String errs;
30543054 Json::Value root;
3055- char const doc[] = " { \ " property\ " :: \ " value\ " }" ;
3055+ char const doc[] = R"( { "property" :: "value" }) " ;
30563056 bool ok = reader->parse (doc, doc + std::strlen (doc), &root, &errs);
30573057 JSONTEST_ASSERT (!ok);
30583058 JSONTEST_ASSERT (errs ==
@@ -3078,7 +3078,7 @@ JSONTEST_FIXTURE_LOCAL(CharReaderTest, parseWithDetailError) {
30783078 CharReaderPtr reader (b.newCharReader ());
30793079 Json::String errs;
30803080 Json::Value root;
3081- char const doc[] = " { \ " property\ " : \ " v\\ alue\ " }" ;
3081+ char const doc[] = R"( { "property" : "v\alue" }) " ;
30823082 bool ok = reader->parse (doc, doc + std::strlen (doc), &root, &errs);
30833083 JSONTEST_ASSERT (!ok);
30843084 JSONTEST_ASSERT (errs ==
@@ -3089,7 +3089,7 @@ JSONTEST_FIXTURE_LOCAL(CharReaderTest, parseWithDetailError) {
30893089JSONTEST_FIXTURE_LOCAL (CharReaderTest, parseWithStackLimit) {
30903090 Json::CharReaderBuilder b;
30913091 Json::Value root;
3092- char const doc[] = " { \ " property\ " : \ " value\ " }" ;
3092+ char const doc[] = R"( { "property" : "value" }) " ;
30933093 {
30943094 b.settings_ [" stackLimit" ] = 2 ;
30953095 CharReaderPtr reader (b.newCharReader ());
@@ -3109,7 +3109,7 @@ JSONTEST_FIXTURE_LOCAL(CharReaderTest, parseWithStackLimit) {
31093109}
31103110
31113111JSONTEST_FIXTURE_LOCAL (CharReaderTest, testOperator) {
3112- const std::string styled = " { \ " property\ " : \ " value\ " }" ;
3112+ const std::string styled = R"( { "property" : "value" }) " ;
31133113 std::istringstream iss (styled);
31143114 Json::Value root;
31153115 iss >> root;
@@ -3122,7 +3122,7 @@ JSONTEST_FIXTURE_LOCAL(CharReaderStrictModeTest, dupKeys) {
31223122 Json::CharReaderBuilder b;
31233123 Json::Value root;
31243124 char const doc[] =
3125- " { \ " property\ " : \ " value\ " , \ " key\ " : \ " val1\ " , \ " key\ " : \ " val2\ " }" ;
3125+ R"( { "property" : "value", "key" : "val1", "key" : "val2" }) " ;
31263126 {
31273127 b.strictMode (&b.settings_ );
31283128 CharReaderPtr reader (b.newCharReader ());
@@ -3141,7 +3141,7 @@ JSONTEST_FIXTURE_LOCAL(CharReaderFailIfExtraTest, issue164) {
31413141 // This is interpreted as a string value followed by a colon.
31423142 Json::CharReaderBuilder b;
31433143 Json::Value root;
3144- char const doc[] = " \ " property\ " : \ " value\ " }" ;
3144+ char const doc[] = R"( "property" : "value" }) " ;
31453145 {
31463146 b.settings_ [" failIfExtra" ] = false ;
31473147 CharReaderPtr reader (b.newCharReader ());
@@ -3445,8 +3445,7 @@ JSONTEST_FIXTURE_LOCAL(CharReaderAllowSpecialFloatsTest, issue209) {
34453445 Json::String errs;
34463446 CharReaderPtr reader (b.newCharReader ());
34473447 {
3448- char const doc[] =
3449- " {\" a\" :NaN,\" b\" :Infinity,\" c\" :-Infinity,\" d\" :+Infinity}" ;
3448+ char const doc[] = R"( {"a":NaN,"b":Infinity,"c":-Infinity,"d":+Infinity})" ;
34503449 bool ok = reader->parse (doc, doc + std::strlen (doc), &root, &errs);
34513450 JSONTEST_ASSERT (ok);
34523451 JSONTEST_ASSERT_STRING_EQUAL (" " , errs);
@@ -3497,7 +3496,7 @@ JSONTEST_FIXTURE_LOCAL(CharReaderAllowSpecialFloatsTest, issue209) {
34973496 }
34983497
34993498 {
3500- char const doc[] = " { \ " posInf\ " : +Infinity, \ " NegInf\ " : -Infinity}" ;
3499+ char const doc[] = R"( { "posInf": +Infinity, "NegInf": -Infinity}) " ;
35013500 bool ok = reader->parse (doc, doc + std::strlen (doc), &root, &errs);
35023501 JSONTEST_ASSERT (ok);
35033502 JSONTEST_ASSERT_STRING_EQUAL (" " , errs);
@@ -3719,7 +3718,7 @@ JSONTEST_FIXTURE_LOCAL(IteratorTest, constness) {
37193718 for (; iter != value.end (); ++iter) {
37203719 out << *iter << ' ,' ;
37213720 }
3722- Json::String expected = " \ " 9\" , \ " 10\" , \ " 11\" , " ;
3721+ Json::String expected = R"( " 9", "10", "11", ) " ;
37233722 JSONTEST_ASSERT_STRING_EQUAL (expected, out.str ());
37243723}
37253724
0 commit comments