From: Peter Krempa Date: Mon, 3 Jul 2017 14:39:21 +0000 (+0200) Subject: tests: virjson: Test parsing and formatting of strings with escaped chars X-Git-Tag: v3.6.0-rc1~126 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6e51642bd2452a89ed36e6308c232bfbeea9191e;p=thirdparty%2Flibvirt.git tests: virjson: Test parsing and formatting of strings with escaped chars Make sure that JSON strings can contain characters which need to be escaped (double quotes, backslashes, tabs, etc.). --- diff --git a/tests/virjsontest.c b/tests/virjsontest.c index a6e1581796..d5a823431b 100644 --- a/tests/virjsontest.c +++ b/tests/virjsontest.c @@ -490,6 +490,10 @@ mymain(void) DO_TEST_PARSE("integer", "1", NULL); DO_TEST_PARSE("boolean", "true", NULL); DO_TEST_PARSE("null", "null", NULL); + + DO_TEST_PARSE("escaping symbols", "[\"\\\"\\t\\n\\\\\"]", NULL); + DO_TEST_PARSE("escaped strings", "[\"{\\\"blurb\\\":\\\"test\\\"}\"]", NULL); + DO_TEST_PARSE_FAIL("incomplete keyword", "tr"); DO_TEST_PARSE_FAIL("overdone keyword", "[ truest ]"); DO_TEST_PARSE_FAIL("unknown keyword", "huh");