Il 21/12/2012 12:45, Gerd Hoffmann ha scritto: > On 12/20/12 14:02, Gerd Hoffmann wrote: >> Hi, >> >>> /me wades through the socket code (unix+tcp) right now, which needs some >>> refactoring to make it fly. >> >> Sneak preview attached. Goes on top of the series. >> Compile tested only so far. > > Now that it comes to testing: how does the union look (in josn) at the wire?
Tests are your friends! (Especially qapi-schema-test.json and test-qmp-input-visitor.c). Something like this: { 'type': 'UserDefA', 'data': { 'boolean': 'bool' } } { 'type': 'UserDefB', 'data': { 'integer': 'int' } } { 'union': 'UserDefUnion', 'data': { 'a' : 'UserDefA', 'b' : 'UserDefB' } } looks like this: { 'type': 'b', 'data' : { 'integer': 42 } } Paolo