On Tue, Sep 1, 2009 at 14:20, Vladimir Pankratovscriptkid@mail.ru wrote:
Hello all.
What do you think about this? What's wrong in this patch? Any comments?
Vladimir Pankratov wrote:
Hi, I think it needs some more tests as stated in RFC 1738, all valid:
telnet://user:password@host:98 http://host:777/path?querystring&another_parameter=value&%20%01 http://host.anything http://host.anything/ http://host.anything:6425/ http://host.anything:479
The RFC itself: http://www.ietf.org/rfc/rfc1738.txt
Best wishes, Bruno
Hello all.
Added test for IsValidURL.
Now test shows error codes and tests exact code.
Thanks Jacek.
changed files: dlls/urlmon/tests/misc.c
Thanks.
diff -u -r a/dlls/urlmon/tests/misc.c b/dlls/urlmon/tests/misc.c --- a/dlls/urlmon/tests/misc.c 2009-08-21 23:34:16.000000000 +0500 +++ b/dlls/urlmon/tests/misc.c 2009-09-01 18:53:08.000000000 +0500 @@ -1326,6 +1326,44 @@ IBindCtx_Release(bctx); } +static void test_IsValidURL(void) +{
- HRESULT hr;
- int i;
- static const WCHAR good_urls[][100] = {
{'f','i','l','e',':','/','/','c',':','\','b','o','o','t','.','i','n','i',0},
{'h','t','t','p',':','/','/','w','w','w','.','w','i','n','e','h','q','.','o','r','g',0},
{'h','t','t','p','s',':','/','/','s','e','c','u','r','e','.','h','o','s','t','.','d','o','m',0},
{'f','t','p',':','/','/','s','o','u','r','c','e','f','o','r','g','e','.','o','r','g',0},
- {'c',':','\','b','o','o','t','.','i','n','i',0},
- {'m','k',0},
- {'h','t','t','p','s',0}
- };
- static const WCHAR bad_urls[][100] = {
- {'w','i','n','e','h','q','.','o','r','g',0},
- {'l','o','c','a','l','h','o','s','t',0},
- {'t','e','s','t',0},
- {'1','2','7','.','0','.','0','.','1',0},
- {'b','o','o','t','.','i','n','i',0}
- };
- hr = IsValidURL(NULL, 0, 10);
- ok(hr == E_INVALIDARG, "IsValidURL should fail, expected
E_INVALIDARG, got %08x.\n", hr);
- for(i = 0; i < sizeof(good_urls)/sizeof(good_urls[0]); i++)
- {
- hr = IsValidURL(NULL, good_urls[i], 0);
- ok(hr == S_OK, "URL %s must be valid, expected S_OK, got
%08x.\n", wine_dbgstr_w(good_urls[i]), hr);
- }
- for(i = 0; i < sizeof(bad_urls)/sizeof(bad_urls[0]); i++)
- {
- hr = IsValidURL(NULL, bad_urls[i], 0);
- ok(hr == S_FALSE, "URL %s must be invalid, expected S_FALSE, got
%08x.\n", wine_dbgstr_w(bad_urls[i]), hr);
- }
+}
START_TEST(misc) { OleInitialize(NULL); @@ -1345,6 +1383,7 @@ test_UrlMkGetSessionOption(); test_user_agent(); test_MkParseDisplayNameEx();
- todo_wine test_IsValidURL();
OleUninitialize(); }