From: Perttu Ahola Date: Sun, 22 Jan 2012 18:40:14 +0000 (+0200) Subject: Fix "illegal escape sequence" in MSVC (actually not illegal) X-Git-Url: http://81.2.79.47:8989/gitweb/?a=commitdiff_plain;h=a387c9b95d293eccca657bee39b6b1d16703650b;p=zefram%2Fminetest%2Fminetest_engine.git Fix "illegal escape sequence" in MSVC (actually not illegal) --- diff --git a/src/test.cpp b/src/test.cpp index 2d5c86e6..23113b12 100644 --- a/src/test.cpp +++ b/src/test.cpp @@ -215,6 +215,8 @@ struct TestSerialization mkstr("\1\0") + teststring2_w_encoded); assert(serializeLongString(teststring2) == mkstr("\0\0\1\0") + teststring2); + // MSVC fails when directly using "\\\\" + std::string backslash = "\\"; assert(serializeJsonString(teststring2) == mkstr("\"") + "\\u0000\\u0001\\u0002\\u0003\\u0004\\u0005\\u0006\\u0007" + @@ -223,7 +225,7 @@ struct TestSerialization "\\u0018\\u0019\\u001a\\u001b\\u001c\\u001d\\u001e\\u001f" + " !\\\"" + teststring2.substr(0x23, 0x2f-0x23) + "\\/" + teststring2.substr(0x30, 0x5c-0x30) + - "\\\\" + teststring2.substr(0x5d, 0x7f-0x5d) + "\\u007f" + + backslash + backslash + teststring2.substr(0x5d, 0x7f-0x5d) + "\\u007f" + "\\u0080\\u0081\\u0082\\u0083\\u0084\\u0085\\u0086\\u0087" + "\\u0088\\u0089\\u008a\\u008b\\u008c\\u008d\\u008e\\u008f" + "\\u0090\\u0091\\u0092\\u0093\\u0094\\u0095\\u0096\\u0097" +