mirror of
https://github.com/curl/curl.git
synced 2026-08-25 10:53:37 +03:00
tests: add urlapi unittest
This adds a new unittest intended to cover the internal functions in the urlapi code, starting with parse_port(). In order to avoid name collisions in debug builds, parse_port() is renamed Curl_parse_port() since it will be exported. Reviewed-by: Daniel Stenberg <daniel@haxx.se> Reviewed-by: Marcel Raad <Marcel.Raad@teamviewer.com>
This commit is contained in:
parent
63533cbde2
commit
e1be2ecba4
6 changed files with 170 additions and 4 deletions
10
lib/urlapi.c
10
lib/urlapi.c
|
|
@ -67,6 +67,12 @@ struct Curl_URL {
|
|||
|
||||
#define DEFAULT_SCHEME "https"
|
||||
|
||||
#ifdef DEBUGBUILD
|
||||
#define UNITTEST
|
||||
#else
|
||||
#define UNITTEST static
|
||||
#endif
|
||||
|
||||
static void free_urlhandle(struct Curl_URL *u)
|
||||
{
|
||||
free(u->scheme);
|
||||
|
|
@ -488,7 +494,7 @@ static CURLUcode parse_hostname_login(struct Curl_URL *u,
|
|||
return result;
|
||||
}
|
||||
|
||||
static CURLUcode parse_port(struct Curl_URL *u, char *hostname)
|
||||
UNITTEST CURLUcode Curl_parse_port(struct Curl_URL *u, char *hostname)
|
||||
{
|
||||
char *portptr = NULL;
|
||||
char endbracket;
|
||||
|
|
@ -845,7 +851,7 @@ static CURLUcode seturl(const char *url, CURLU *u, unsigned int flags)
|
|||
if(result)
|
||||
return result;
|
||||
|
||||
result = parse_port(u, hostname);
|
||||
result = Curl_parse_port(u, hostname);
|
||||
if(result)
|
||||
return result;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue