Commit 674fb3c0 authored by Nikolay Sivov's avatar Nikolay Sivov Committed by Alexandre Julliard

msxml3: Some tests to show that leading spaces are not allowed for xml stream.

parent 9397fb2a
...@@ -1737,6 +1737,15 @@ static const char xpath_simple_list[] = ...@@ -1737,6 +1737,15 @@ static const char xpath_simple_list[] =
" <d/>" " <d/>"
"</root>"; "</root>";
static const char* leading_spaces[] = {
"\n<?xml version=\"1.0\"?><root/>",
" <?xml version=\"1.0\"?><root/>",
"\t<?xml version=\"1.0\"?><root/>",
"\r\n<?xml version=\"1.0\"?><root/>",
"\r<?xml version=\"1.0\"?><root/>",
0
};
static const WCHAR szNonExistentFile[] = { static const WCHAR szNonExistentFile[] = {
'c', ':', '\\', 'N', 'o', 'n', 'e', 'x', 'i', 's', 't', 'e', 'n', 't', '.', 'x', 'm', 'l', 0 'c', ':', '\\', 'N', 'o', 'n', 'e', 'x', 'i', 's', 't', 'e', 'n', 't', '.', 'x', 'm', 'l', 0
}; };
...@@ -1999,7 +2008,7 @@ static char *list_to_string(IXMLDOMNodeList *list) ...@@ -1999,7 +2008,7 @@ static char *list_to_string(IXMLDOMNodeList *list)
static void test_domdoc( void ) static void test_domdoc( void )
{ {
HRESULT r; HRESULT r, hr;
IXMLDOMDocument *doc; IXMLDOMDocument *doc;
IXMLDOMParseError *error; IXMLDOMParseError *error;
IXMLDOMElement *element = NULL; IXMLDOMElement *element = NULL;
...@@ -2016,6 +2025,7 @@ static void test_domdoc( void ) ...@@ -2016,6 +2025,7 @@ static void test_domdoc( void )
LONG code; LONG code;
LONG nLength = 0; LONG nLength = 0;
WCHAR buff[100]; WCHAR buff[100];
const char **ptr;
doc = create_document(&IID_IXMLDOMDocument); doc = create_document(&IID_IXMLDOMDocument);
if (!doc) return; if (!doc) return;
...@@ -2027,14 +2037,27 @@ if (0) ...@@ -2027,14 +2037,27 @@ if (0)
} }
/* try some stupid things */ /* try some stupid things */
r = IXMLDOMDocument_loadXML( doc, NULL, NULL ); hr = IXMLDOMDocument_loadXML( doc, NULL, NULL );
ok( r == S_FALSE, "loadXML succeeded\n"); EXPECT_HR(hr, S_FALSE);
b = VARIANT_TRUE; b = VARIANT_TRUE;
r = IXMLDOMDocument_loadXML( doc, NULL, &b ); hr = IXMLDOMDocument_loadXML( doc, NULL, &b );
ok( r == S_FALSE, "loadXML succeeded\n"); EXPECT_HR(hr, S_FALSE);
ok( b == VARIANT_FALSE, "failed to load XML string\n"); ok( b == VARIANT_FALSE, "failed to load XML string\n");
/* load document with leading spaces */
ptr = leading_spaces;
while (*ptr)
{
b = VARIANT_TRUE;
V_VT(&var) = VT_BSTR;
V_BSTR(&var) = _bstr_(*ptr);
hr = IXMLDOMDocument_load( doc, var, &b);
EXPECT_HR(hr, S_FALSE);
ok( b == VARIANT_FALSE, "got %x\n", b);
ptr++;
}
/* try to load a document from a nonexistent file */ /* try to load a document from a nonexistent file */
b = VARIANT_TRUE; b = VARIANT_TRUE;
str = SysAllocString( szNonExistentFile ); str = SysAllocString( szNonExistentFile );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment