[libvirt] [PATCH v2 2/4] tests: virjson: Remove spaces from 'very-hard' parsing example

Peter Krempa posted 4 patches 8 years, 7 months ago
[libvirt] [PATCH v2 2/4] tests: virjson: Remove spaces from 'very-hard' parsing example
Posted by Peter Krempa 8 years, 7 months ago
The example is rather long and upcomming patch will check whether the
string can be formatted back. As the formatted string lacks spaces and
adding the 'expect' string with spaces would be rather long, just drop
spaces from this test case.

There are other test cases which do contain spaces.
---
 tests/virjsontest.c | 48 ++++++++++++++++++++++++------------------------
 1 file changed, 24 insertions(+), 24 deletions(-)

diff --git a/tests/virjsontest.c b/tests/virjsontest.c
index a5ffc4707..029a580f4 100644
--- a/tests/virjsontest.c
+++ b/tests/virjsontest.c
@@ -386,30 +386,30 @@ mymain(void)
                   "\"label\": \"charmonitor\"}, {\"filename\": \"pty:/dev/pts/158\","
                   "\"label\": \"charserial0\"}], \"id\": \"libvirt-3\"}");

-    DO_TEST_PARSE("VeryHard", "{\"return\": [{\"name\": \"quit\"}, {\"name\":"
-                  "\"eject\"}, {\"name\": \"change\"}, {\"name\": \"screendump\"},"
-                  "{\"name\": \"stop\"}, {\"name\": \"cont\"}, {\"name\": "
-                  "\"system_reset\"}, {\"name\": \"system_powerdown\"}, "
-                  "{\"name\": \"device_add\"}, {\"name\": \"device_del\"}, "
-                  "{\"name\": \"cpu\"}, {\"name\": \"memsave\"}, {\"name\": "
-                  "\"pmemsave\"}, {\"name\": \"migrate\"}, {\"name\": "
-                  "\"migrate_cancel\"}, {\"name\": \"migrate_set_speed\"},"
-                  "{\"name\": \"client_migrate_info\"}, {\"name\": "
-                  "\"migrate_set_downtime\"}, {\"name\": \"netdev_add\"}, "
-                  "{\"name\": \"netdev_del\"}, {\"name\": \"block_resize\"},"
-                  "{\"name\": \"balloon\"}, {\"name\": \"set_link\"}, {\"name\":"
-                  "\"getfd\"}, {\"name\": \"closefd\"}, {\"name\": \"block_passwd\"},"
-                  "{\"name\": \"set_password\"}, {\"name\": \"expire_password\"},"
-                  "{\"name\": \"qmp_capabilities\"}, {\"name\": "
-                  "\"human-monitor-command\"}, {\"name\": \"query-version\"},"
-                  "{\"name\": \"query-commands\"}, {\"name\": \"query-chardev\"},"
-                  "{\"name\": \"query-block\"}, {\"name\": \"query-blockstats\"}, "
-                  "{\"name\": \"query-cpus\"}, {\"name\": \"query-pci\"}, {\"name\":"
-                  "\"query-kvm\"}, {\"name\": \"query-status\"}, {\"name\": "
-                  "\"query-mice\"}, {\"name\": \"query-vnc\"}, {\"name\": "
-                  "\"query-spice\"}, {\"name\": \"query-name\"}, {\"name\": "
-                  "\"query-uuid\"}, {\"name\": \"query-migrate\"}, {\"name\": "
-                  "\"query-balloon\"}], \"id\": \"libvirt-2\"}");
+    DO_TEST_PARSE("VeryHard", "{\"return\":[{\"name\":\"quit\"},{\"name\":"
+                  "\"eject\"},{\"name\":\"change\"},{\"name\":\"screendump\"},"
+                  "{\"name\":\"stop\"},{\"name\":\"cont\"},{\"name\":"
+                  "\"system_reset\"},{\"name\":\"system_powerdown\"},"
+                  "{\"name\":\"device_add\"},{\"name\":\"device_del\"},"
+                  "{\"name\":\"cpu\"},{\"name\":\"memsave\"},{\"name\":"
+                  "\"pmemsave\"},{\"name\":\"migrate\"},{\"name\":"
+                  "\"migrate_cancel\"},{\"name\":\"migrate_set_speed\"},"
+                  "{\"name\":\"client_migrate_info\"},{\"name\":"
+                  "\"migrate_set_downtime\"},{\"name\":\"netdev_add\"},"
+                  "{\"name\":\"netdev_del\"},{\"name\":\"block_resize\"},"
+                  "{\"name\":\"balloon\"},{\"name\":\"set_link\"},{\"name\":"
+                  "\"getfd\"},{\"name\":\"closefd\"},{\"name\":\"block_passwd\"},"
+                  "{\"name\":\"set_password\"},{\"name\":\"expire_password\"},"
+                  "{\"name\":\"qmp_capabilities\"},{\"name\":"
+                  "\"human-monitor-command\"},{\"name\":\"query-version\"},"
+                  "{\"name\":\"query-commands\"},{\"name\":\"query-chardev\"},"
+                  "{\"name\":\"query-block\"},{\"name\":\"query-blockstats\"},"
+                  "{\"name\":\"query-cpus\"},{\"name\":\"query-pci\"},{\"name\":"
+                  "\"query-kvm\"},{\"name\":\"query-status\"},{\"name\":"
+                  "\"query-mice\"},{\"name\":\"query-vnc\"},{\"name\":"
+                  "\"query-spice\"},{\"name\":\"query-name\"},{\"name\":"
+                  "\"query-uuid\"},{\"name\":\"query-migrate\"},{\"name\":"
+                  "\"query-balloon\"}],\"id\":\"libvirt-2\"}");

     DO_TEST_FULL("add and remove", AddRemove,
                  "{\"name\": \"sample\", \"value\": true}",
-- 
2.12.2

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH v2 2/4] tests: virjson: Remove spaces from 'very-hard' parsing example
Posted by John Ferlan 8 years, 6 months ago

On 07/11/2017 08:56 AM, Peter Krempa wrote:
> The example is rather long and upcomming patch will check whether the
> string can be formatted back. As the formatted string lacks spaces and
> adding the 'expect' string with spaces would be rather long, just drop
> spaces from this test case.
> 
> There are other test cases which do contain spaces.
> ---
>  tests/virjsontest.c | 48 ++++++++++++++++++++++++------------------------
>  1 file changed, 24 insertions(+), 24 deletions(-)
> 

Reviewed-by: John Ferlan <jferlan@redhat.com>

John

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