()
| 404 | |
| 405 | #[test] |
| 406 | fn read_buffer_exception_safety() { |
| 407 | let mut buf = ReadBuffer::<U4>::default(); |
| 408 | |
| 409 | let res = catch_unwind(AssertUnwindSafe(|| { |
| 410 | buf.write_block( |
| 411 | 1, |
| 412 | |block| { |
| 413 | block[0] = 0xFF; |
| 414 | panic!("block generation panic"); |
| 415 | }, |
| 416 | |_| {}, |
| 417 | ); |
| 418 | })); |
| 419 | |
| 420 | assert!(res.is_err()); |
| 421 | let _ = buf.get_pos(); |
| 422 | |
| 423 | let mut buf = ReadBuffer::<U4>::default(); |
| 424 | |
| 425 | let res = catch_unwind(AssertUnwindSafe(|| { |
| 426 | buf.write_block( |
| 427 | 1, |
| 428 | |block| block.0 = [0xFF; 4], |
| 429 | |_| panic!("data read panic"), |
| 430 | ); |
| 431 | })); |
| 432 | |
| 433 | assert!(res.is_err()); |
| 434 | let _ = buf.get_pos(); |
| 435 | } |
nothing calls this directly
no test coverage detected