@@ -1874,7 +1874,7 @@ JSONTEST_FIXTURE_LOCAL(ValueTest, CommentBefore) {
1874
1874
Json::String result = Json::writeString (wbuilder, val);
1875
1875
JSONTEST_ASSERT_STRING_EQUAL (expected, result);
1876
1876
Json::String res2 = val.toStyledString ();
1877
- Json::String exp2 = " " ;
1877
+ Json::String exp2 ;
1878
1878
exp2 += expected;
1879
1879
exp2 += " \n " ;
1880
1880
JSONTEST_ASSERT_STRING_EQUAL (exp2 , res2);
@@ -2592,7 +2592,7 @@ JSONTEST_FIXTURE_LOCAL(StreamWriterTest, indentation) {
2592
2592
JSONTEST_FIXTURE_LOCAL (StreamWriterTest, writeZeroes) {
2593
2593
Json::String binary (" hi" , 3 ); // include trailing 0
2594
2594
JSONTEST_ASSERT_EQUAL (3 , binary.length ());
2595
- Json::String expected (" \ " hi\\ u0000\" " ); // unicoded zero
2595
+ Json::String expected (R"( "hi\u0000" ) " ); // unicoded zero
2596
2596
Json::StreamWriterBuilder b;
2597
2597
{
2598
2598
Json::Value root;
@@ -2866,7 +2866,7 @@ JSONTEST_FIXTURE_LOCAL(CharReaderTest, parseWithNoErrors) {
2866
2866
CharReaderPtr reader (b.newCharReader ());
2867
2867
Json::String errs;
2868
2868
Json::Value root;
2869
- char const doc[] = " { \ " property\ " : \ " value\ " }" ;
2869
+ char const doc[] = R"( { "property" : "value" }) " ;
2870
2870
bool ok = reader->parse (doc, doc + std::strlen (doc), &root, &errs);
2871
2871
JSONTEST_ASSERT (ok);
2872
2872
JSONTEST_ASSERT (errs.empty ());
@@ -2914,14 +2914,14 @@ JSONTEST_FIXTURE_LOCAL(CharReaderTest, parseString) {
2914
2914
JSONTEST_ASSERT_EQUAL (" " , root[0 ]);
2915
2915
}
2916
2916
{
2917
- char const doc[] = " [ \"\\ u8A2a\" ] " ;
2917
+ char const doc[] = R"( ["\ u8A2a"] ) " ;
2918
2918
bool ok = reader->parse (doc, doc + std::strlen (doc), &root, &errs);
2919
2919
JSONTEST_ASSERT (ok);
2920
2920
JSONTEST_ASSERT (errs.empty ());
2921
2921
JSONTEST_ASSERT_EQUAL (u8" \u8A2a " , root[0 ].asString ()); // "訪"
2922
2922
}
2923
2923
{
2924
- char const doc[] = " [ \"\\ uD801\ " ]" ;
2924
+ char const doc[] = R"( [ "\ uD801" ]) " ;
2925
2925
bool ok = reader->parse (doc, doc + std::strlen (doc), &root, &errs);
2926
2926
JSONTEST_ASSERT (!ok);
2927
2927
JSONTEST_ASSERT (errs == " * Line 1, Column 3\n "
@@ -2930,7 +2930,7 @@ JSONTEST_FIXTURE_LOCAL(CharReaderTest, parseString) {
2930
2930
" See Line 1, Column 10 for detail.\n " );
2931
2931
}
2932
2932
{
2933
- char const doc[] = " [ \"\\ uD801\\ d1234\ " ]" ;
2933
+ char const doc[] = R"( [ "\ uD801\d1234" ]) " ;
2934
2934
bool ok = reader->parse (doc, doc + std::strlen (doc), &root, &errs);
2935
2935
JSONTEST_ASSERT (!ok);
2936
2936
JSONTEST_ASSERT (errs == " * Line 1, Column 3\n "
@@ -2939,7 +2939,7 @@ JSONTEST_FIXTURE_LOCAL(CharReaderTest, parseString) {
2939
2939
" See Line 1, Column 12 for detail.\n " );
2940
2940
}
2941
2941
{
2942
- char const doc[] = " [ \"\\ ua3t@\ " ]" ;
2942
+ char const doc[] = R"( [ "\ ua3t@" ]) " ;
2943
2943
bool ok = reader->parse (doc, doc + std::strlen (doc), &root, &errs);
2944
2944
JSONTEST_ASSERT (!ok);
2945
2945
JSONTEST_ASSERT (errs == " * Line 1, Column 3\n "
@@ -2948,7 +2948,7 @@ JSONTEST_FIXTURE_LOCAL(CharReaderTest, parseString) {
2948
2948
" See Line 1, Column 9 for detail.\n " );
2949
2949
}
2950
2950
{
2951
- char const doc[] = " [ \"\\ ua3t\ " ]" ;
2951
+ char const doc[] = R"( [ "\ ua3t" ]) " ;
2952
2952
bool ok = reader->parse (doc, doc + std::strlen (doc), &root, &errs);
2953
2953
JSONTEST_ASSERT (!ok);
2954
2954
JSONTEST_ASSERT (
@@ -2960,7 +2960,7 @@ JSONTEST_FIXTURE_LOCAL(CharReaderTest, parseString) {
2960
2960
{
2961
2961
b.settings_ [" allowSingleQuotes" ] = true ;
2962
2962
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'}) " ;
2964
2964
bool ok = charreader->parse (doc, doc + std::strlen (doc), &root, &errs);
2965
2965
JSONTEST_ASSERT (ok);
2966
2966
JSONTEST_ASSERT_STRING_EQUAL (" " , errs);
@@ -3007,15 +3007,15 @@ JSONTEST_FIXTURE_LOCAL(CharReaderTest, parseObjectWithErrors) {
3007
3007
Json::Value root;
3008
3008
Json::String errs;
3009
3009
{
3010
- char const doc[] = " { \ " property\ " : \ " value\" " ;
3010
+ char const doc[] = R"( { "property" : "value" ) " ;
3011
3011
bool ok = reader->parse (doc, doc + std::strlen (doc), &root, &errs);
3012
3012
JSONTEST_ASSERT (!ok);
3013
3013
JSONTEST_ASSERT (errs == " * Line 1, Column 24\n "
3014
3014
" Missing ',' or '}' in object declaration\n " );
3015
3015
JSONTEST_ASSERT_EQUAL (" value" , root[" property" ]);
3016
3016
}
3017
3017
{
3018
- char const doc[] = " { \ " property\ " : \ " value\ " ," ;
3018
+ char const doc[] = R"( { "property" : "value" ,) " ;
3019
3019
bool ok = reader->parse (doc, doc + std::strlen (doc), &root, &errs);
3020
3020
JSONTEST_ASSERT (!ok);
3021
3021
JSONTEST_ASSERT (errs == " * Line 1, Column 25\n "
@@ -3038,7 +3038,7 @@ JSONTEST_FIXTURE_LOCAL(CharReaderTest, parseArrayWithErrors) {
3038
3038
JSONTEST_ASSERT_EQUAL (" value" , root[0 ]);
3039
3039
}
3040
3040
{
3041
- char const doc[] = " [ \ " value1\" \ " value2\ " ]" ;
3041
+ char const doc[] = R"( [ "value1" "value2" ]) " ;
3042
3042
bool ok = reader->parse (doc, doc + std::strlen (doc), &root, &errs);
3043
3043
JSONTEST_ASSERT (!ok);
3044
3044
JSONTEST_ASSERT (errs == " * Line 1, Column 12\n "
@@ -3052,7 +3052,7 @@ JSONTEST_FIXTURE_LOCAL(CharReaderTest, parseWithOneError) {
3052
3052
CharReaderPtr reader (b.newCharReader ());
3053
3053
Json::String errs;
3054
3054
Json::Value root;
3055
- char const doc[] = " { \ " property\ " :: \ " value\ " }" ;
3055
+ char const doc[] = R"( { "property" :: "value" }) " ;
3056
3056
bool ok = reader->parse (doc, doc + std::strlen (doc), &root, &errs);
3057
3057
JSONTEST_ASSERT (!ok);
3058
3058
JSONTEST_ASSERT (errs ==
@@ -3078,7 +3078,7 @@ JSONTEST_FIXTURE_LOCAL(CharReaderTest, parseWithDetailError) {
3078
3078
CharReaderPtr reader (b.newCharReader ());
3079
3079
Json::String errs;
3080
3080
Json::Value root;
3081
- char const doc[] = " { \ " property\ " : \ " v\\ alue\ " }" ;
3081
+ char const doc[] = R"( { "property" : "v\alue" }) " ;
3082
3082
bool ok = reader->parse (doc, doc + std::strlen (doc), &root, &errs);
3083
3083
JSONTEST_ASSERT (!ok);
3084
3084
JSONTEST_ASSERT (errs ==
@@ -3089,7 +3089,7 @@ JSONTEST_FIXTURE_LOCAL(CharReaderTest, parseWithDetailError) {
3089
3089
JSONTEST_FIXTURE_LOCAL (CharReaderTest, parseWithStackLimit) {
3090
3090
Json::CharReaderBuilder b;
3091
3091
Json::Value root;
3092
- char const doc[] = " { \ " property\ " : \ " value\ " }" ;
3092
+ char const doc[] = R"( { "property" : "value" }) " ;
3093
3093
{
3094
3094
b.settings_ [" stackLimit" ] = 2 ;
3095
3095
CharReaderPtr reader (b.newCharReader ());
@@ -3109,7 +3109,7 @@ JSONTEST_FIXTURE_LOCAL(CharReaderTest, parseWithStackLimit) {
3109
3109
}
3110
3110
3111
3111
JSONTEST_FIXTURE_LOCAL (CharReaderTest, testOperator) {
3112
- const std::string styled = " { \ " property\ " : \ " value\ " }" ;
3112
+ const std::string styled = R"( { "property" : "value" }) " ;
3113
3113
std::istringstream iss (styled);
3114
3114
Json::Value root;
3115
3115
iss >> root;
@@ -3122,7 +3122,7 @@ JSONTEST_FIXTURE_LOCAL(CharReaderStrictModeTest, dupKeys) {
3122
3122
Json::CharReaderBuilder b;
3123
3123
Json::Value root;
3124
3124
char const doc[] =
3125
- " { \ " property\ " : \ " value\ " , \ " key\ " : \ " val1\ " , \ " key\ " : \ " val2\ " }" ;
3125
+ R"( { "property" : "value", "key" : "val1", "key" : "val2" }) " ;
3126
3126
{
3127
3127
b.strictMode (&b.settings_ );
3128
3128
CharReaderPtr reader (b.newCharReader ());
@@ -3141,7 +3141,7 @@ JSONTEST_FIXTURE_LOCAL(CharReaderFailIfExtraTest, issue164) {
3141
3141
// This is interpreted as a string value followed by a colon.
3142
3142
Json::CharReaderBuilder b;
3143
3143
Json::Value root;
3144
- char const doc[] = " \ " property\ " : \ " value\ " }" ;
3144
+ char const doc[] = R"( "property" : "value" }) " ;
3145
3145
{
3146
3146
b.settings_ [" failIfExtra" ] = false ;
3147
3147
CharReaderPtr reader (b.newCharReader ());
@@ -3445,8 +3445,7 @@ JSONTEST_FIXTURE_LOCAL(CharReaderAllowSpecialFloatsTest, issue209) {
3445
3445
Json::String errs;
3446
3446
CharReaderPtr reader (b.newCharReader ());
3447
3447
{
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})" ;
3450
3449
bool ok = reader->parse (doc, doc + std::strlen (doc), &root, &errs);
3451
3450
JSONTEST_ASSERT (ok);
3452
3451
JSONTEST_ASSERT_STRING_EQUAL (" " , errs);
@@ -3497,7 +3496,7 @@ JSONTEST_FIXTURE_LOCAL(CharReaderAllowSpecialFloatsTest, issue209) {
3497
3496
}
3498
3497
3499
3498
{
3500
- char const doc[] = " { \ " posInf\ " : +Infinity, \ " NegInf\ " : -Infinity}" ;
3499
+ char const doc[] = R"( { "posInf": +Infinity, "NegInf": -Infinity}) " ;
3501
3500
bool ok = reader->parse (doc, doc + std::strlen (doc), &root, &errs);
3502
3501
JSONTEST_ASSERT (ok);
3503
3502
JSONTEST_ASSERT_STRING_EQUAL (" " , errs);
@@ -3719,7 +3718,7 @@ JSONTEST_FIXTURE_LOCAL(IteratorTest, constness) {
3719
3718
for (; iter != value.end (); ++iter) {
3720
3719
out << *iter << ' ,' ;
3721
3720
}
3722
- Json::String expected = " \ " 9\" , \ " 10\" , \ " 11\" , " ;
3721
+ Json::String expected = R"( " 9", "10", "11", ) " ;
3723
3722
JSONTEST_ASSERT_STRING_EQUAL (expected, out.str ());
3724
3723
}
3725
3724
0 commit comments