Files
bytes/tests/test_take.rs
T

13 lines
333 B
Rust
Raw Normal View History

#![warn(rust_2018_idioms)]
2017-06-27 11:23:29 -07:00
2020-10-16 15:16:23 -07:00
use bytes::buf::Buf;
2017-06-27 11:23:29 -07:00
#[test]
fn long_take() {
// Tests that get a take with a size greater than the buffer length will not
2017-06-27 11:23:29 -07:00
// overrun the buffer. Regression test for #138.
let buf = b"hello world".take(100);
2017-06-27 11:23:29 -07:00
assert_eq!(11, buf.remaining());
assert_eq!(b"hello world", buf.bytes());
}