Skip to content

Commit 552fc94

Browse files
author
David James
committed
test: surface "attempt to subtract with overflow"
This is essentially the same test setup as #12.
1 parent 9262444 commit 552fc94

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

src/tests/test_read.rs

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,27 @@ fn test_len_26_read_read() {
4646
}
4747
}
4848

49+
#[test]
50+
fn test_len_26_read_seek_current_1_read() {
51+
let mut store = crc_store(26); // body_len=12
52+
{
53+
let mut read_buf = vec![0; 20]; // only 0 needed
54+
let result = store.read(&mut read_buf);
55+
assert!(result.is_ok());
56+
assert_eq!(result.unwrap(), 18);
57+
}
58+
{
59+
let result = store.seek(SeekFrom::Current(1));
60+
assert!(result.is_ok());
61+
}
62+
{
63+
let mut read_buf = vec![0; 20]; // only 0 needed
64+
let result = store.read(&mut read_buf);
65+
assert!(result.is_ok());
66+
assert_eq!(result.unwrap(), 0);
67+
}
68+
}
69+
4970
#[test]
5071
#[rustfmt::skip]
5172
fn test_len_128_read() {

0 commit comments

Comments
 (0)