test/docstrings fixes (#207)

This commit is contained in:
Zrzka 2019-09-14 10:33:20 +02:00 committed by Timon
parent 2d4c1eec4d
commit 10af72ba2a
2 changed files with 10 additions and 11 deletions

View File

@ -43,12 +43,12 @@ impl TerminalInput {
/// Not sure what 'raw mode' is, checkout the 'crossterm_screen' crate. /// Not sure what 'raw mode' is, checkout the 'crossterm_screen' crate.
/// ///
/// # Example /// # Example
/// ```rust /// ```ignore
/// let input = input(); /// let in = input();
/// match input.read_line() { /// match in.read_line() {
/// Ok(s) => println!("string typed: {}", s), /// Ok(s) => println!("string typed: {}", s),
/// Err(e) => println!("error: {}", e), /// Err(e) => println!("error: {}", e),
/// } /// }
/// ``` /// ```
pub fn read_line(&self) -> io::Result<String> { pub fn read_line(&self) -> io::Result<String> {
let mut rv = String::new(); let mut rv = String::new();
@ -60,13 +60,12 @@ impl TerminalInput {
/// Read one character from the user input /// Read one character from the user input
/// ///
/// ```rust /// ```ignore
/// let input = input(); /// let in = input();
/// /// match in.read_char() {
/// match input.read_char() {
/// Ok(c) => println!("character pressed: {}", c), /// Ok(c) => println!("character pressed: {}", c),
/// Err(e) => println!("error: {}", e), /// Err(e) => println!("error: {}", e),
/// } /// }
/// ``` /// ```
pub fn read_char(&self) -> io::Result<char> { pub fn read_char(&self) -> io::Result<char> {
self.input.read_char() self.input.read_char()

View File

@ -487,10 +487,10 @@ where
#[test] #[test]
fn test_parse_utf8() { fn test_parse_utf8() {
let st = "abcéŷ¤£€ù%323"; let st = "abcéŷ¤£€ù%323";
let ref mut bytes = st.bytes().map(|x| Ok(x)); let ref mut bytes = st.bytes();
let chars = st.chars(); let chars = st.chars();
for c in chars { for c in chars {
let b = bytes.next().unwrap().unwrap(); let b = bytes.next().unwrap();
assert_eq!(c, parse_utf8_char(b, bytes).unwrap()); assert_eq!(c, parse_utf8_char(b, bytes).unwrap());
} }
} }