Simplify test code a bit, use Request::new() to simplfy constructing requests
This commit is contained in:
@@ -5,10 +5,9 @@ use std::io::Cursor;
|
||||
fn it_reads_strings() {
|
||||
let buffer = [0x0, 0x3, b'F', b'o', b'o'];
|
||||
|
||||
assert_eq!(
|
||||
read_string(&mut buffer.as_ref()).unwrap(),
|
||||
"Foo".to_string()
|
||||
);
|
||||
let result = read_string(&mut buffer.as_ref()).unwrap();
|
||||
|
||||
assert_eq!(result, "Foo");
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -17,8 +16,5 @@ fn it_writes_strings() {
|
||||
|
||||
write_string(&mut buffer, "Foo").unwrap();
|
||||
|
||||
// Should have written exactly 5 bytes
|
||||
assert_eq!(buffer.get_ref().len(), 5usize);
|
||||
|
||||
assert_eq!(&buffer.get_ref()[0..5], [0x0, 0x3, b'F', b'o', b'o']);
|
||||
assert_eq!(buffer.into_inner(), [0x0, 0x3, b'F', b'o', b'o']);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user