Skip to content

Commit 262b84d

Browse files
committed
test: fix assertions in test_ensure_capacity_loop
Otherwise the test fails if BLOCK_SIZE constant is reduced.
1 parent 108c5c3 commit 262b84d

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/imap_stream.rs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -412,13 +412,18 @@ mod tests {
412412
// Ask for `i` bytes.
413413
buf.ensure_capacity(i).unwrap();
414414

415-
// Test that we can read at least as much as requested.
415+
// Test that we can read at least 1 byte.
416416
let free = buf.free_as_mut_slice();
417417
let used = free.len();
418-
assert!(used >= i);
418+
assert!(used > 0);
419419

420420
// Use as much as allowed.
421421
buf.extend_used(used);
422+
423+
// Test that we can read at least as much as requested.
424+
let block = buf.take_block();
425+
assert!(block.len() >= i);
426+
buf.return_block(block);
422427
}
423428
}
424429

0 commit comments

Comments
 (0)