diff options
author | Richard Walters <rwalters@digitalstirling.com> | 2020-10-05 14:03:26 -0700 |
---|---|---|
committer | Richard Walters <rwalters@digitalstirling.com> | 2020-10-05 14:03:26 -0700 |
commit | f95b6e2d031de4d59dafe094386da6d4a6074dad (patch) | |
tree | 18772e9de9afa60532150f14f4e766d7c20d684e | |
parent | da7c16742836067e0a7e921679c54fe16b6fa7ae (diff) |
Add tests for parsing hosts ending in dot
-rw-r--r-- | src/lib.rs | 11 | ||||
-rw-r--r-- | test/src/UriTests.cpp | 6 |
2 files changed, 17 insertions, 0 deletions
@@ -441,6 +441,17 @@ mod tests { } #[test] + fn parse_from_string_host_ends_in_dot() { + let uri = uriparse::URIReference::try_from("http://example.com./foo"); + assert!(uri.is_ok()); + let uri = uri.unwrap(); + assert_eq!( + Some(&uriparse::Host::try_from("example.com.").unwrap()), + uri.host() + ); + } + + #[test] fn parse_from_string_dont_misinterpret_colon_in_other_places_as_scheme_delimiter() { let test_vectors = [ "//foo:bar@www.example.com/", diff --git a/test/src/UriTests.cpp b/test/src/UriTests.cpp index e3737c2..34e3483 100644 --- a/test/src/UriTests.cpp +++ b/test/src/UriTests.cpp @@ -292,6 +292,12 @@ TEST(UriTests, ParseFromStringSchemeMixedCase) { } } +TEST(UriTests, ParseFromStringHostEndsInDot) { + Uri::Uri uri; + ASSERT_TRUE(uri.ParseFromString("http://example.com./foo")); + ASSERT_EQ("example.com.", uri.GetHost()); +} + TEST(UriTests, ParseFromStringUserInfoIllegalCharacters) { const std::vector< std::string > testVectors{ {"//%X@www.example.com/"}, |