mirror of
https://github.com/pocoproject/poco.git
synced 2025-04-16 06:56:41 +02:00
parent
d866e7444d
commit
18a5a380d2
@ -1163,11 +1163,13 @@ void StringTest::testJSONString()
|
||||
assert (toJSON("\\", false) == "\\\\");
|
||||
assert (toJSON("\"", false) == "\\\"");
|
||||
assert (toJSON("/", false) == "\\/");
|
||||
assert (toJSON("\a", false) == "\\a");
|
||||
assert (toJSON("\b", false) == "\\b");
|
||||
assert (toJSON("\f", false) == "\\f");
|
||||
assert (toJSON("\n", false) == "\\n");
|
||||
assert (toJSON("\r", false) == "\\r");
|
||||
assert (toJSON("\t", false) == "\\t");
|
||||
assert (toJSON("\v", false) == "\\v");
|
||||
assert (toJSON("a", false) == "a");
|
||||
|
||||
// ??? on MSVC, the assert macro expansion
|
||||
|
@ -1870,9 +1870,16 @@ void JSONTest::testEscapeUnicode()
|
||||
std::stringstream ss;
|
||||
object->stringify(ss);
|
||||
|
||||
//assert(ss.str().compare("{\"name\":\"B\\u0000b\"}") == 0);
|
||||
assert(ss.str().compare("{\"name\":\"\\u4E2D\"}") == 0);
|
||||
|
||||
std::cout << ss.str() << std::endl;
|
||||
const unsigned char utf8Chars[] = {'{', '"', 'n', 'a', 'm', 'e', '"', ':',
|
||||
'"', 'g', 195, 188, 'n', 't', 'e', 'r', '"', '}', 0};
|
||||
std::string utf8Text((const char*) utf8Chars);
|
||||
parser.reset();
|
||||
result = parser.parse(utf8Text);
|
||||
object = result.extract<Object::Ptr>();
|
||||
ss.str(""); object->stringify(ss);
|
||||
assert (ss.str() == "{\"name\":\"g\\u00FCnter\"}");
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user