[PATCH v3 1/2] tests: virjson: Test parsing and formatting of strings with escaped chars

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Make sure that JSON strings can contain characters which need to be
escaped (double quotes, backslashes, tabs, etc.).
---
 tests/virjsontest.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/tests/virjsontest.c b/tests/virjsontest.c
index a6e158179..d5a823431 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");
-- 
2.13.2

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]
  Powered by Linux