Commit Graph

11 Commits

Author SHA1 Message Date
Andrea Bolognani
3e7db8d3e8 Remove backslash alignment attempts
Right-aligning backslashes when defining macros or using complex
commands in Makefiles looks cute, but as soon as any changes is
required to the code you end up with either distractingly broken
alignment or unnecessarily big diffs where most of the changes
are just pushing all backslashes a few characters to one side.

Generated using

  $ git grep -El '[[:blank:]][[:blank:]]\\$' | \
    grep -E '*\.([chx]|am|mk)$$' | \
    while read f; do \
      sed -Ei 's/[[:blank:]]*[[:blank:]]\\$/ \\/g' "$f"; \
    done

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
2017-11-03 13:24:12 +01:00
Peter Krempa
99eac2668c tests: virjson: Test nesting of JSON string into a JSON (string) property
Test that we are able to create a JSON object and nest it into a string
property of a JSON object and then correctly extract and parse it back.
2017-07-19 17:59:09 +02:00
Peter Krempa
6e51642bd2 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.).
2017-07-19 17:59:09 +02:00
Peter Krempa
0c02071b56 tests: virjson: Test formatting along with parsing of JSON objects
Format the parsed string back and compare it to the original (or
modified) string for back and forth comparison.
2017-07-19 15:24:10 +02:00
Peter Krempa
85f7620212 tests: virjson: Remove spaces from 'very-hard' parsing example
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.
2017-07-19 15:24:10 +02:00
Peter Krempa
0a2866b42a tests: virjson: Modify logic in testJSONFromString
To allow better testing in case where the string was parsed, modify the
logic so that the regular code path is not included in a conditional
block.
2017-07-19 15:24:10 +02:00
Peter Krempa
a1ac4c880b tests: virjson: Reuse VIR_TEST_VERBOSE in testJSONCopy
Use VIR_TEST_VERBOSE instead of calling virTestGetVerbose and
conditionally fprintf. Additionally remove redundant setting of 'ret' to
-1.
2017-07-11 14:40:05 +02:00
Peter Krempa
ffdf532328 tests: Validate that JSON deflattening fixed nested json pseudo-protocol strings
Sheepdog and possibly others use nested objects for network server and
thus could be specified in a way that libvirt would not parse.

Validates that https://bugzilla.redhat.com/show_bug.cgi?id=1464821
is fixed properly.
2017-07-11 14:24:17 +02:00
Peter Krempa
d40f4b3e67 util: json: Properly implement JSON deflattening
As it turns out sometimes users pass in an arbitrarily nested structure
e.g. for the qemu backing chains JSON pseudo protocol. This new
implementation deflattens now a single object fully even with nested
keys.

Additionally it's not necessary now to stick with the "file." prefix for
the properties.
2017-07-11 14:13:35 +02:00
Peter Krempa
7f1209ad1e tests: json: Add test for the deflattening function
Add a few test cases to verify that the old behaviour does not break and
that new one behaves sanely.
2017-07-11 14:12:55 +02:00
Peter Krempa
9f0b7e99c5 tests: Rename jsontest to virjsontest 2017-07-11 14:02:28 +02:00