aboutsummaryrefslogtreecommitdiff
path: root/tests/qmp-test.c
diff options
context:
space:
mode:
Diffstat (limited to 'tests/qmp-test.c')
-rw-r--r--tests/qmp-test.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/tests/qmp-test.c b/tests/qmp-test.c
index 1715319..5edc97f 100644
--- a/tests/qmp-test.c
+++ b/tests/qmp-test.c
@@ -71,6 +71,13 @@ static void test_malformed(QTestState *qts)
qobject_unref(resp);
g_assert(recovered(qts));
+ /* lexical error: funny control character outside string */
+ qtest_qmp_send_raw(qts, "{\x01");
+ resp = qtest_qmp_receive(qts);
+ g_assert_cmpstr(get_error_class(resp), ==, "GenericError");
+ qobject_unref(resp);
+ g_assert(recovered(qts));
+
/* lexical error: impossible byte in string */
qtest_qmp_send_raw(qts, "{'bad \xFF");
resp = qtest_qmp_receive(qts);
@@ -78,6 +85,13 @@ static void test_malformed(QTestState *qts)
qobject_unref(resp);
g_assert(recovered(qts));
+ /* lexical error: control character in string */
+ qtest_qmp_send_raw(qts, "{'execute': 'nonexistent', 'id':'\n'}");
+ resp = qtest_qmp_receive(qts);
+ g_assert_cmpstr(get_error_class(resp), ==, "CommandNotFound"); /* BUG */
+ qobject_unref(resp);
+ g_assert(recovered(qts));
+
/* lexical error: interpolation */
qtest_qmp_send_raw(qts, "%%p\n");
resp = qtest_qmp_receive(qts);