From c111d873c50bc5c1d8f7950e8adb718739fc681d Mon Sep 17 00:00:00 2001 From: ankit <1994constant@gmail.com> Date: Sun, 28 Jun 2020 18:44:57 +0530 Subject: [PATCH] make more doctests pass --- src/ini.rs | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/src/ini.rs b/src/ini.rs index 94183f3..b0ae923 100644 --- a/src/ini.rs +++ b/src/ini.rs @@ -155,7 +155,7 @@ impl Ini { Ok(self.map.clone()) } - ///Writes the current configuation to the specfied path. If a file is not present, it is automatically created for you, if a file already + ///Writes the current configuation to the specified path. If a file is not present, it is automatically created for you, if a file already ///exists, it is truncated and the configuration is written to it. ///## Example ///```rust @@ -349,8 +349,13 @@ impl Ini { ///Parses the stored value from the key stored in the defined section to an `i64`. ///## Example - ///```ignore,rust - ///let value = config.getint("section", "key")?.unwrap(); + ///```rust + ///use configparser::ini::Ini; + /// + ///let mut config = Ini::new(); + ///config.load("tests/test.ini"); + ///let value = config.getint("values", "int").unwrap().unwrap(); + ///assert_eq!(value, -31415); // value accessible! ///``` ///Returns `Ok(Some(value))` of type `i64` if value is found or else returns `Ok(None)`. ///If the parsing fails, it returns an `Err(string)`. @@ -372,8 +377,13 @@ impl Ini { ///Parses the stored value from the key stored in the defined section to a `u64`. ///## Example - ///```ignore,rust - ///let value = config.getuint("section", "key")?.unwrap(); + ///```rust + ///use configparser::ini::Ini; + /// + ///let mut config = Ini::new(); + ///config.load("tests/test.ini"); + ///let value = config.getint("values", "Uint").unwrap().unwrap(); + ///assert_eq!(value, 31415); // value accessible! ///``` ///Returns `Ok(Some(value))` of type `u64` if value is found or else returns `Ok(None)`. ///If the parsing fails, it returns an `Err(string)`.