aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Walters <rwalters@digitalstirling.com>2020-10-16 15:04:04 -0700
committerRichard Walters <rwalters@digitalstirling.com>2020-10-16 15:04:04 -0700
commitbc57f058e630f9f2e53867b48e0e710c72d7d8ec (patch)
treeac48bef9f4195b520d426b5048f6b7f35caeb157
parentdf19e6b005c6a08e2b068ec0468c50db31387002 (diff)
Version 1.0.2
* Code in doc examples needs to be reachable through a "main" function, otherwise the tests silently fail to detect problems. * The example for `Uri::resolve` was calling `path_to_string` rather than `to_string`.
-rw-r--r--Cargo.toml2
-rw-r--r--src/authority.rs4
-rw-r--r--src/uri.rs10
3 files changed, 8 insertions, 8 deletions
diff --git a/Cargo.toml b/Cargo.toml
index 34dc7cf..6cc3a6b 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "rhymuri"
-version = "1.0.1"
+version = "1.0.2"
description = "Implementation of IETF RFC 3986, Uniform Resource Identifier (URI)"
authors = ["Richard Walters <rwalters@digitalstirling.com>"]
edition = "2018"
diff --git a/src/authority.rs b/src/authority.rs
index 18d86fa..bde7a06 100644
--- a/src/authority.rs
+++ b/src/authority.rs
@@ -20,7 +20,7 @@ use super::validate_ipv6_address::validate_ipv6_address;
/// # extern crate rhymuri;
/// use rhymuri::Authority;
///
-/// # fn test() -> Result<(), rhymuri::Error> {
+/// # fn main() -> Result<(), rhymuri::Error> {
/// let authority = Authority::parse("nobody@www.example.com:8080")?;
/// assert_eq!(Some("nobody".as_bytes()), authority.userinfo());
/// assert_eq!("www.example.com".as_bytes(), authority.host());
@@ -35,7 +35,7 @@ use super::validate_ipv6_address::validate_ipv6_address;
/// # extern crate rhymuri;
/// use rhymuri::Authority;
///
-/// # fn test() -> Result<(), rhymuri::Error> {
+/// # fn main() -> Result<(), rhymuri::Error> {
/// let mut authority = Authority::default();
/// authority.set_userinfo(Some("nobody").map(Into::into));
/// authority.set_host("www.example.com");
diff --git a/src/uri.rs b/src/uri.rs
index b49cb96..ea362c5 100644
--- a/src/uri.rs
+++ b/src/uri.rs
@@ -39,7 +39,7 @@ use super::character_classes::{
/// # extern crate rhymuri;
/// use rhymuri::Uri;
///
-/// # fn test() -> Result<(), rhymuri::Error> {
+/// # fn main() -> Result<(), rhymuri::Error> {
/// let uri = Uri::parse("http://www.example.com/foo?bar#baz")?;
/// let authority = uri.authority().unwrap();
/// assert_eq!("www.example.com".as_bytes(), authority.host());
@@ -229,7 +229,7 @@ impl Uri {
/// # extern crate rhymuri;
/// use rhymuri::Uri;
///
- /// # fn test() -> Result<(), rhymuri::Error> {
+ /// # fn main() -> Result<(), rhymuri::Error> {
/// let mut uri = Uri::parse("/a/b/c/./../../g")?;
/// uri.normalize();
/// assert_eq!("/a/g", uri.path_to_string()?);
@@ -489,11 +489,11 @@ impl Uri {
/// # extern crate rhymuri;
/// use rhymuri::Uri;
///
- /// # fn test() -> Result<(), rhymuri::Error> {
+ /// # fn main() -> Result<(), rhymuri::Error> {
/// let base = Uri::parse("http://a/b/c/d;p?q")?;
/// let relative_reference = Uri::parse("g;x?y#s")?;
/// let resolved = base.resolve(&relative_reference);
- /// assert_eq!("http://a/b/c/g;x?y#s", resolved.path_to_string()?);
+ /// assert_eq!("http://a/b/c/g;x?y#s", resolved.to_string());
/// # Ok(())
/// # }
/// ```
@@ -1300,7 +1300,7 @@ mod tests {
let base_uri = Uri::parse(test_vector.base_string()).unwrap();
let relative_reference_uri = Uri::parse(test_vector.relative_reference_string()).unwrap();
let expected_target_uri = Uri::parse(test_vector.target_string()).unwrap();
- let actual_target_uri = base_uri.resolve(&relative_reference_uri);
+ let actual_target_uri = dbg!(base_uri.resolve(&relative_reference_uri));
assert_eq!(expected_target_uri, actual_target_uri);
}
}