Skip to content
Snippets Groups Projects
Commit 1f188b56 authored by Nikolay Kim's avatar Nikolay Kim
Browse files

fix dropping front block in BlockBuf

parent f693e038
No related branches found
No related tags found
No related merge requests found
......@@ -175,7 +175,7 @@ impl BlockBuf {
block.drop(segment_n);
!MutBuf::has_remaining(block)
block.len() == 0
};
if pop {
......
......@@ -6,6 +6,7 @@ extern crate byteorder;
// == Buf
mod test_append;
mod test_block;
mod test_buf;
mod test_buf_fill;
mod test_byte_buf;
......
use bytes::{MutBuf, BlockBuf};
#[test]
pub fn test_block_drop() {
let mut buf = BlockBuf::new(2, 4);
assert_eq!(buf.remaining(), 8);
buf.write_slice(b"12345");
buf.write_slice(b"678");
assert_eq!(buf.remaining(), 0);
assert_eq!(buf.len(), 8);
buf.drop(1);
assert_eq!(buf.len(), 7);
assert_eq!(buf.is_compact(), false);
buf.drop(4);
assert_eq!(buf.len(), 3);
assert_eq!(buf.is_compact(), true);
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment