diff options
author | Charlie Swanson <cswanson310@gmail.com> | 2014-10-29 14:03:13 -0400 |
---|---|---|
committer | Benety Goh <benety@mongodb.com> | 2014-10-30 16:17:27 -0400 |
commit | ce37440b32dcd61744e3767208d8bf5a174217e4 (patch) | |
tree | 06ac2fee0eac9ca795db09fd2af76c3e60401250 /src | |
parent | 65187924dc8921594424918cd3fc64181e695cda (diff) | |
download | mongo-ce37440b32dcd61744e3767208d8bf5a174217e4.tar.gz |
SERVER-15887 Add tests for ipv6 hostname parsing.
Closes #846
Signed-off-by: Benety Goh <benety@mongodb.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/mongo/util/net/hostandport_test.cpp | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/mongo/util/net/hostandport_test.cpp b/src/mongo/util/net/hostandport_test.cpp index fb59092b0e9..38f2192541e 100644 --- a/src/mongo/util/net/hostandport_test.cpp +++ b/src/mongo/util/net/hostandport_test.cpp @@ -79,6 +79,7 @@ namespace { ASSERT_EQUALS(HostAndPort("abc"), HostAndPort("abc", -1)); ASSERT_EQUALS(HostAndPort("abc.def:3421"), HostAndPort("abc.def", 3421)); ASSERT_EQUALS(HostAndPort("[124d:]:34"), HostAndPort("124d:", 34)); + ASSERT_EQUALS(HostAndPort("[124d:efg]:34"), HostAndPort("124d:efg", 34)); ASSERT_EQUALS(HostAndPort("[124d:]"), HostAndPort("124d:", -1)); } @@ -92,6 +93,8 @@ namespace { ASSERT_EQUALS(ErrorCodes::FailedToParse, HostAndPort::parse("[124d:]asdf:34").getStatus()); ASSERT_EQUALS(ErrorCodes::FailedToParse, HostAndPort::parse("124d:asdf:34").getStatus()); ASSERT_EQUALS(ErrorCodes::FailedToParse, HostAndPort::parse("1234:").getStatus()); + ASSERT_EQUALS(ErrorCodes::FailedToParse, HostAndPort::parse("[[124d]]").getStatus()); + ASSERT_EQUALS(ErrorCodes::FailedToParse, HostAndPort::parse("[[124d]:34]").getStatus()); ASSERT_EQUALS(unittest::assertGet(HostAndPort::parse("abc")), HostAndPort("abc", -1)); ASSERT_EQUALS(unittest::assertGet(HostAndPort::parse("abc.def:3421")), |