diff options
author | Brad King <brad.king@kitware.com> | 2020-02-25 14:41:26 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2020-02-25 14:41:26 (GMT) |
commit | 71764b88d6c9b36ccfc8add02334e99ddbfdc537 (patch) | |
tree | f985b900dcf85850f45b08c7a8bb2f3802851c80 /Source/kwsys/testSystemTools.cxx | |
parent | 64198c4f073149341a8ae2ba3d5976c07e2120c2 (diff) | |
parent | 4e8c4c7ebe539e59e8323d1ac79e51366a0720aa (diff) | |
download | CMake-71764b88d6c9b36ccfc8add02334e99ddbfdc537.zip CMake-71764b88d6c9b36ccfc8add02334e99ddbfdc537.tar.gz CMake-71764b88d6c9b36ccfc8add02334e99ddbfdc537.tar.bz2 |
Merge branch 'upstream-KWSys' into update-kwsys
# By KWSys Upstream
* upstream-KWSys:
KWSys 2020-02-25 (b14ce28a)
Diffstat (limited to 'Source/kwsys/testSystemTools.cxx')
-rw-r--r-- | Source/kwsys/testSystemTools.cxx | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/Source/kwsys/testSystemTools.cxx b/Source/kwsys/testSystemTools.cxx index 3f6eeb8..6afc326 100644 --- a/Source/kwsys/testSystemTools.cxx +++ b/Source/kwsys/testSystemTools.cxx @@ -1086,6 +1086,34 @@ static bool CheckCopyFileIfDifferent() return ret; } +static bool CheckURLParsing() +{ + bool ret = true; + std::string url = "http://user:pw@hostname:42/full/url.com"; + + std::string protocol, username, password, hostname, dataport, database; + kwsys::SystemTools::ParseURL(url, protocol, username, password, hostname, + dataport, database); + if (protocol != "http" || username != "user" || password != "pw" || + hostname != "hostname" || dataport != "42" || + database != "full/url.com") { + std::cerr << "Incorrect URL parsing" << std::endl; + ret = false; + } + + std::string uri = + "file://hostname/path/to/" + "a%20file%20with%20str%C3%A0ng%C3%A8%20ch%40r%20and%20s%C2%B5aces"; + kwsys::SystemTools::ParseURL(uri, protocol, username, password, hostname, + dataport, database, true); + if (protocol != "file" || hostname != "hostname" || + database != "path/to/a file with stràngè ch@r and sµaces") { + std::cerr << "Incorrect URL parsing or decoding" << std::endl; + ret = false; + } + return ret; +} + int testSystemTools(int, char* []) { bool res = true; @@ -1133,5 +1161,7 @@ int testSystemTools(int, char* []) res &= CheckCopyFileIfDifferent(); + res &= CheckURLParsing(); + return res ? 0 : 1; } |