aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorJan Engelhardt <[email protected]>2024-01-30 11:38:41 +0000
committerGitHub <[email protected]>2024-01-30 11:38:41 +0000
commit874a1d8c33ef80402be95a1ebee01902e14f12e4 (patch)
treef9ab1cbf69df0010c2d273357f65f50564d5b1d3 /tests
parentFixed confusing source/bin dirs in makefile. (#291) (diff)
downloadvmime-874a1d8c33ef80402be95a1ebee01902e14f12e4.tar.gz
vmime-874a1d8c33ef80402be95a1ebee01902e14f12e4.zip
url: support IPv6 literals (RFC 2732) (#292)
Diffstat (limited to 'tests')
-rw-r--r--tests/utility/urlTest.cpp20
1 files changed, 20 insertions, 0 deletions
diff --git a/tests/utility/urlTest.cpp b/tests/utility/urlTest.cpp
index d26cfb81..c792c772 100644
--- a/tests/utility/urlTest.cpp
+++ b/tests/utility/urlTest.cpp
@@ -35,6 +35,7 @@ VMIME_TEST_SUITE_BEGIN(urlTest)
VMIME_TEST(testParse3)
VMIME_TEST(testParse4)
VMIME_TEST(testParse5)
+ VMIME_TEST(testParseIPv6)
VMIME_TEST(testGenerate)
VMIME_TEST(testUtilsEncode)
VMIME_TEST(testUtilsDecode)
@@ -201,6 +202,18 @@ VMIME_TEST_SUITE_BEGIN(urlTest)
VASSERT_EQ("4", "myserver.com", u1.getHost());
}
+ void testParseIPv6() {
+
+ vmime::utility::url u1("", "");
+
+ VASSERT_EQ("1", true, parseHelper(u1, "http://a:b@[::1]:80/p"));
+ VASSERT_EQ("2", "a", u1.getUsername());
+ VASSERT_EQ("3", "b", u1.getPassword());
+ VASSERT_EQ("4", "::1", u1.getHost());
+ VASSERT_EQ("5", 80, u1.getPort());
+ VASSERT_EQ("6", "/p", u1.getPath());
+ }
+
void testGenerate() {
vmime::utility::url u1("proto", "host", 12345, "path", "user", "password");
@@ -235,6 +248,13 @@ VMIME_TEST_SUITE_BEGIN(urlTest)
"proto://host/?%26=%3D",
static_cast <vmime::string>(u3)
);
+
+ vmime::utility::url u5("http", "::1", 80, "p");
+ VASSERT_EQ(
+ "4",
+ "http://[::1]:80/p",
+ static_cast <vmime::string>(u5)
+ );
}
void testUtilsEncode() {