wininet: Add more tests for InternetCrackurl.

This commit is contained in:
James Hawkins 2006-07-14 16:45:46 -07:00 committed by Alexandre Julliard
parent 6de2ca8459
commit a1544731db
2 changed files with 25 additions and 0 deletions

View file

@ -1323,6 +1323,13 @@ BOOL WINAPI InternetCrackUrlW(LPCWSTR lpszUrl_orig, DWORD dwUrlLength_orig, DWOR
dwUrlLength=strlenW(lpszUrl);
TRACE("(%s %lu %lx %p)\n", debugstr_w(lpszUrl), dwUrlLength, dwFlags, lpUC);
if (!lpszUrl_orig || !*lpszUrl_orig)
{
SetLastError(ERROR_INVALID_PARAMETER);
return FALSE;
}
if (dwFlags & ICU_DECODE)
{
lpszUrl_decode=HeapAlloc( GetProcessHeap(), 0, dwUrlLength * sizeof (WCHAR) );

View file

@ -208,6 +208,24 @@ static void InternetCrackUrl_test(void)
ok(!strcmp(urlComponents.lpszScheme, "about"), "lpszScheme was \"%s\" instead of \"about\"\n", urlComponents.lpszScheme);
ok(!strcmp(urlComponents.lpszHostName, "host"), "lpszHostName was \"%s\" instead of \"host\"\n", urlComponents.lpszHostName);
ok(!strcmp(urlComponents.lpszUrlPath, "/blank"), "lpszUrlPath was \"%s\" instead of \"/blank\"\n", urlComponents.lpszUrlPath);
/* try a NULL lpszUrl */
SetLastError(0xdeadbeef);
copy_compsA(&urlSrc, &urlComponents, 32, 1024, 1024, 1024, 2048, 1024);
ret = InternetCrackUrl(NULL, 0, 0, &urlComponents);
GLE = GetLastError();
ok(ret == FALSE, "Expected InternetCrackUrl to fail\n");
ok(GLE == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %ld\n", GLE);
/* try an empty lpszUrl, GetLastError returns 12006, whatever that means
* we just need to fail and not return success
*/
SetLastError(0xdeadbeef);
copy_compsA(&urlSrc, &urlComponents, 32, 1024, 1024, 1024, 2048, 1024);
ret = InternetCrackUrl("", 0, 0, &urlComponents);
GLE = GetLastError();
ok(ret == FALSE, "Expected InternetCrackUrl to fail\n");
ok(GLE != 0xdeadbeef && GLE != ERROR_SUCCESS, "Expected GLE to represent a failure\n");
}
static void InternetCrackUrlW_test(void)