From a6f18e5ea9a0e18da6d3355cf1ba16f9ab4f0b26 Mon Sep 17 00:00:00 2001 From: Robert Garrett Date: Mon, 13 Oct 2025 08:03:43 -0500 Subject: [PATCH] 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. --- tests/codec.rs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/tests/codec.rs b/tests/codec.rs index 6828d6a..4e6383d 100644 --- a/tests/codec.rs +++ b/tests/codec.rs @@ -20,8 +20,13 @@ impl From 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| {