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 });
|
headers.set(Host { hostname: "foo.bar".to_owned(), port: None });
|
||||||
|
|
||||||
let s = headers.to_string();
|
let s = headers.to_string();
|
||||||
// hashmap's iterators have arbitrary order, so we must sort first
|
assert!(s.contains("Host: foo.bar\r\n"));
|
||||||
let mut pieces = s.split("\r\n").collect::<Vec<&str>>();
|
assert!(s.contains("Content-Length: 15\r\n"));
|
||||||
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
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
|||||||
Reference in New Issue
Block a user