diff options
Diffstat (limited to 'third_party/rust/bytes-0.4.12/tests/test_take.rs')
-rw-r--r-- | third_party/rust/bytes-0.4.12/tests/test_take.rs | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/third_party/rust/bytes-0.4.12/tests/test_take.rs b/third_party/rust/bytes-0.4.12/tests/test_take.rs new file mode 100644 index 0000000000..93e0c6c5ab --- /dev/null +++ b/third_party/rust/bytes-0.4.12/tests/test_take.rs @@ -0,0 +1,13 @@ +extern crate bytes; + +use bytes::Buf; +use std::io::Cursor; + +#[test] +fn long_take() { + // Tests that take with a size greater than the buffer length will not + // overrun the buffer. Regression test for #138. + let buf = Cursor::new(b"hello world").take(100); + assert_eq!(11, buf.remaining()); + assert_eq!(b"hello world", buf.bytes()); +} |