[1/2] msxml3/tests: Reduce code duplication for the namespace change tests.

Nikolay Sivov bunglehead at gmail.com
Tue Jun 12 06:11:01 CDT 2012


On 6/12/2012 11:52, Ulrik Dickow wrote:
> Patch 1 of 2 from http://bugs.winehq.org/show_bug.cgi?id=26226 .
>
>
>

> +static void test_namespaces_change(int doc_version)
> +{
> +    IXMLDOMDocument *doc;
> +    IXMLDOMElement *elem;
> +    IXMLDOMNode *node;
> +
> +    VARIANT var;
> +    HRESULT hr;
> +    BSTR str;
> +
> +    /* create on element and try to alter namespace after that */
> +    doc = (doc_version == 0 ?
> +           create_document(&IID_IXMLDOMDocument) :
> +           create_document_version(60, &IID_IXMLDOMDocument));
> +    if (!doc) return;
Please use something like CLSID array with every available Document 
CLSID, instead of only testing 2 of them. There's a lot of examples for 
that in saxreader.c.

> +    test_namespaces_change(0);
> +    test_namespaces_change(60);
>   
>       free_bstrs();
>   }
It's better to avoid nested test calls like that imho, you could just 
add another call in main test list.

> +static void test_namespaces_change(int doc_version)
> +{
> +    IXMLDOMDocument *doc;
> +    IXMLDOMElement *elem;
> +    IXMLDOMNode *node;
...
> +
> +    IXMLDOMElement_Release(elem);
> +    IXMLDOMDocument_Release(doc);
> +}
> +
When this is running on all CLSIDs please add free_bstrs() here.



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.winehq.org/pipermail/wine-devel/attachments/20120612/c9ca0c64/attachment.html>


More information about the wine-devel mailing list