X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=src%2Ftest%2Ftest-json.c;h=24dc7003bc64292c109b2012da008d73b8ec9106;hb=e0952d9d021234e79f3a70f33a9e5d201872a417;hp=00768358bf4469105b7ee05e43b2f0c6a3c51559;hpb=30c873fbfb9bb291330d50aae8fb67d774a0e4f8;p=elogind.git diff --git a/src/test/test-json.c b/src/test/test-json.c index 00768358b..24dc7003b 100644 --- a/src/test/test-json.c +++ b/src/test/test-json.c @@ -21,7 +21,6 @@ #include -#include "log.h" #include "util.h" #include "json.h" @@ -98,6 +97,10 @@ int main(int argc, char *argv[]) { test_one("{\"foo\" : [true, false]}", JSON_OBJECT_OPEN, JSON_STRING, "foo", JSON_COLON, JSON_ARRAY_OPEN, JSON_BOOLEAN, true, JSON_COMMA, JSON_BOOLEAN, false, JSON_ARRAY_CLOSE, JSON_OBJECT_CLOSE, JSON_END); test_one("\"\xef\xbf\xbd\"", JSON_STRING, "\xef\xbf\xbd", JSON_END); test_one("\"\\ufffd\"", JSON_STRING, "\xef\xbf\xbd", JSON_END); + test_one("\"\\uf\"", -EINVAL); + test_one("\"\\ud800a\"", -EINVAL); + test_one("\"\\udc00\\udc00\"", -EINVAL); + test_one("\"\\ud801\\udc37\"", JSON_STRING, "\xf0\x90\x90\xb7", JSON_END); return 0; }