Rename codec.rs test function, use new err enum

I'm trying to minimize the number of panics even in test code. Some are
going to stay because I'm lazy and it makes no difference for a test.
This commit is contained in:
2025-10-13 08:03:43 -05:00
parent 7ba2e7760b
commit a6f18e5ea9

View File

@@ -20,8 +20,13 @@ impl From<DecodeError> for TestError {
}
#[test]
fn main() -> Result<(), DecodeError> {
let file = File::open("qoi_test_images/dice.qoi").unwrap();
/// There are test images provided by the QOI spec author: https://qoiformat.org/qoi_test_images.zip
/// This function looks for them in `./qoi_test_images/` and turns them all
/// into PNGs. Manual inspection is required to evaluate the test result.
fn decode_qoi_samples() -> Result<(), TestError> {
let file = File::open("qoi_test_images/dice.qoi").map_err(|_io_err| TestError::SetupFailure)?;
// TODO: feed the Result<> forward, don't let a panic path be given to an unaware caller.
let mut bytes = file.bytes()
.map(|maybe_bytes|
{