test(header): change test_headers_show to use str.contains
This commit is contained in:
@@ -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]
|
||||
|
||||
Reference in New Issue
Block a user