mirror of
https://github.com/ciphervance/supercell-wx.git
synced 2025-10-30 17:00:05 +00:00
Added local file tests, and make URL tests more complete for NormalizeUrl
This commit is contained in:
parent
950620de6e
commit
f0bfca8588
1 changed files with 43 additions and 7 deletions
|
|
@ -12,13 +12,49 @@ namespace util
|
|||
{
|
||||
|
||||
const std::vector<std::pair<const std::string, const std::string>> testUrls = {
|
||||
{" https://example.com/ ", "https://example.com/"},
|
||||
{"\thttps://example.com/\t", "https://example.com/"},
|
||||
{"\nhttps://example.com/\n", "https://example.com/"},
|
||||
{"\rhttps://example.com/\r", "https://example.com/"},
|
||||
{"\r\nhttps://example.com/\r\n", "https://example.com/"},
|
||||
{" https://example.com/ ", "https://example.com/"},
|
||||
{" \nhttps://example.com/ \n ", "https://example.com/"},
|
||||
{" https://example.com/path/to+a+test/file.txt ",
|
||||
"https://example.com/path/to+a+test/file.txt"},
|
||||
{"\thttps://example.com/path/to+a+test/file.txt\t",
|
||||
"https://example.com/path/to+a+test/file.txt"},
|
||||
{"\nhttps://example.com/path/to+a+test/file.txt\n",
|
||||
"https://example.com/path/to+a+test/file.txt"},
|
||||
{"\rhttps://example.com/path/to+a+test/file.txt\r",
|
||||
"https://example.com/path/to+a+test/file.txt"},
|
||||
{"\r\nhttps://example.com/path/to+a+test/file.txt\r\n",
|
||||
"https://example.com/path/to+a+test/file.txt"},
|
||||
{" https://example.com/path/to+a+test/file.txt ",
|
||||
"https://example.com/path/to+a+test/file.txt"},
|
||||
{" \nhttps://example.com/path/to+a+test/file.txt \n ",
|
||||
"https://example.com/path/to+a+test/file.txt"},
|
||||
|
||||
// Only tested for this OS because NormalizeUrl uses native separators
|
||||
#ifdef _WIN32
|
||||
{" C:\\path\\to a test\\file.txt ", "C:\\path\\to a test\\file.txt"},
|
||||
{"\tC:\\path\\to a test\\file.txt\t", "C:\\path\\to a test\\file.txt"},
|
||||
{"\nC:\\path\\to a test\\file.txt\n", "C:\\path\\to a test\\file.txt"},
|
||||
{"\rC:\\path\\to a test\\file.txt\r", "C:\\path\\to a test\\file.txt"},
|
||||
{"\r\nC:\\path\\to a test\\file.txt\r\n", "C:\\path\\to a test\\file.txt"},
|
||||
{" C:\\path\\to a test\\file.txt ", "C:\\path\\to a test\\file.txt"},
|
||||
{" \nC:\\path\\to a test\\file.txt \n ",
|
||||
"C:\\path\\to a test\\file.txt"},
|
||||
|
||||
{" C:/path/to a test/file.txt ", "C:\\path\\to a test\\file.txt"},
|
||||
{"\tC:/path/to a test/file.txt\t", "C:\\path\\to a test\\file.txt"},
|
||||
{"\nC:/path/to a test/file.txt\n", "C:\\path\\to a test\\file.txt"},
|
||||
{"\rC:/path/to a test/file.txt\r", "C:\\path\\to a test\\file.txt"},
|
||||
{"\r\nC:/path/to a test/file.txt\r\n", "C:\\path\\to a test\\file.txt"},
|
||||
{" C:/path/to a test/file.txt ", "C:\\path\\to a test\\file.txt"},
|
||||
{" \nC:/path/to a test/file.txt \n ", "C:\\path\\to a test\\file.txt"},
|
||||
#else
|
||||
|
||||
{" /path/to a test/file.txt ", "/path/to a test/file.txt"},
|
||||
{"\t/path/to a test/file.txt\t", "/path/to a test/file.txt"},
|
||||
{"\n/path/to a test/file.txt\n", "/path/to a test/file.txt"},
|
||||
{"\r/path/to a test/file.txt\r", "/path/to a test/file.txt"},
|
||||
{"\r\n/path/to a test/file.txt\r\n", "/path/to a test/file.txt"},
|
||||
{" /path/to a test/file.txt ", "/path/to a test/file.txt"},
|
||||
{" \n/path/to a test/file.txt \n ", "/path/to a test/file.txt"},
|
||||
#endif
|
||||
};
|
||||
|
||||
TEST(network, NormalizeUrl)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue