GNOME Bugzilla – Bug 788960
Fix the XML test
Last modified: 2017-10-16 12:58:23 UTC
The XML test in tests/xml.c has been known to be broken for a while. There have been some minor aggravations recently, but the fundamental problem is that rest_xml_node_print's output is tied to the GHashTable implementation. Here's how it fails with librest-0.8.0: ** (process:31623): ERROR **: Generated output for parsed XML does not match: in: <node0 a00='v00' a01='v01'><node1 a10='v10'></node1><node1 a10='v10'></node1>Cont0</node0> out: <node0 a01='v01' a00='v00'><node1 a10='v10'></node1><node1 a10='v10'></node1>Cont0</node0> It uses GHashTableIter to iterate over the various hash tables and directly prints each key-value pair. The order in which a GHashTable is iterated isn't defined, which makes rest_xml_node_print a bad fit for our test suite. It would be nice if the order in which it traverses a node stays stable for a given librest version, as opposed to changing with the glib version. That'll at least let us use it in our test suite, even if we don't document the behaviour as an API contract.
Created attachment 361548 [details] [review] xml-node: Remove stray blank space
Created attachment 361549 [details] [review] xml-node: Unbreak the creation of top-level nodes
Created attachment 361550 [details] [review] xml-node: Define the order in which attributes & children are printed
Created attachment 361551 [details] [review] tests: Re-enable the XML test
Thanks a lot for tackling this, looks good to me, ack series.
Thanks for the reviews, Christophe! Pushed to master.