refactor(hyper): add tests and refactor to increase coverage

This commit is contained in:
Pyfisch
2015-05-01 14:31:53 +02:00
parent 7f5e0382d9
commit ff346f147f
7 changed files with 49 additions and 54 deletions

View File

@@ -129,6 +129,7 @@ impl fmt::Display for Method {
mod tests {
use std::collections::HashMap;
use std::str::FromStr;
use error::Error;
use super::Method;
use super::Method::{Get, Post, Put, Extension};
@@ -150,6 +151,11 @@ mod tests {
assert_eq!(Get, FromStr::from_str("GET").unwrap());
assert_eq!(Extension("MOVE".to_string()),
FromStr::from_str("MOVE").unwrap());
let x: Result<Method, _> = FromStr::from_str("");
if let Err(Error::Method) = x {
} else {
panic!("An empty method is invalid!")
}
}
#[test]