Commit 6f26adbe authored by Kenton Varda's avatar Kenton Varda

Merge pull request #266 from eriksjolund/whitespace_characters

adjust the set of white space characters to the set described by RFC7159
parents 672615f5 efc5dc9d
...@@ -294,6 +294,15 @@ KJ_TEST("basic json decoding") { ...@@ -294,6 +294,15 @@ KJ_TEST("basic json decoding") {
KJ_EXPECT(root.getObject().size() == 0); KJ_EXPECT(root.getObject().size() == 0);
} }
{
MallocMessageBuilder message;
auto root = message.initRoot<JsonValue>();
json.decodeRaw("\r\n\t {\r\n\t }\r\n\t ", root);
KJ_EXPECT(root.which() == JsonValue::OBJECT, (uint)root.which());
KJ_EXPECT(root.getObject().size() == 0);
}
{ {
MallocMessageBuilder message; MallocMessageBuilder message;
auto root = message.initRoot<JsonValue>(); auto root = message.initRoot<JsonValue>();
...@@ -429,6 +438,8 @@ KJ_TEST("basic json decoding") { ...@@ -429,6 +438,8 @@ KJ_TEST("basic json decoding") {
KJ_EXPECT_THROW_MESSAGE("Invalid hex", json.decodeRaw(R"("\u12zz")", root)); KJ_EXPECT_THROW_MESSAGE("Invalid hex", json.decodeRaw(R"("\u12zz")", root));
KJ_EXPECT_THROW_MESSAGE("ends prematurely", json.decodeRaw("-", root)); KJ_EXPECT_THROW_MESSAGE("ends prematurely", json.decodeRaw("-", root));
KJ_EXPECT_THROW_MESSAGE("Unexpected input", json.decodeRaw("--", root)); KJ_EXPECT_THROW_MESSAGE("Unexpected input", json.decodeRaw("--", root));
KJ_EXPECT_THROW_MESSAGE("Unexpected input", json.decodeRaw("\f{}", root));
KJ_EXPECT_THROW_MESSAGE("Unexpected input", json.decodeRaw("{\v}", root));
} }
} }
......
...@@ -581,11 +581,9 @@ public: ...@@ -581,11 +581,9 @@ public:
consumeWhile([](char chr) { consumeWhile([](char chr) {
return ( return (
chr == ' ' || chr == ' ' ||
chr == '\f' ||
chr == '\n' || chr == '\n' ||
chr == '\r' || chr == '\r' ||
chr == '\t' || chr == '\t'
chr == '\v'
); );
}); });
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment