test(header): change test_headers_show to use str.contains

This commit is contained in:
Sean McArthur
2015-07-23 12:09:55 -07:00
parent a0739e6c96
commit da817ba8bf

View File

@@ -658,13 +658,8 @@ mod tests {
headers.set(Host { hostname: "foo.bar".to_owned(), port: None });
let s = headers.to_string();
// hashmap's iterators have arbitrary order, so we must sort first
let mut pieces = s.split("\r\n").collect::<Vec<&str>>();
pieces.sort();
assert_eq!(pieces.len(), 3);
assert_eq!(pieces[0], "Host: foo.bar");
assert_eq!(pieces[1], "Content-Length: 15");
assert_eq!(pieces[2], ""); // trailing \r\n
assert!(s.contains("Host: foo.bar\r\n"));
assert!(s.contains("Content-Length: 15\r\n"));
}
#[test]