Add an error enum to test/codec.rs
This commit is contained in:
@@ -7,6 +7,18 @@ use std::io::BufWriter;
|
|||||||
use std::path::Path;
|
use std::path::Path;
|
||||||
use std::{fs::File, io::Read};
|
use std::{fs::File, io::Read};
|
||||||
|
|
||||||
|
#[derive(Debug)]
|
||||||
|
enum TestError {
|
||||||
|
SetupFailure, // an error during test initialization (missing file, no write permission for output)
|
||||||
|
CodecFailure(DecodeError),
|
||||||
|
}
|
||||||
|
|
||||||
|
impl From<DecodeError> for TestError {
|
||||||
|
fn from(err: DecodeError) -> Self {
|
||||||
|
Self::CodecFailure(err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn main() -> Result<(), DecodeError> {
|
fn main() -> Result<(), DecodeError> {
|
||||||
let file = File::open("qoi_test_images/dice.qoi").unwrap();
|
let file = File::open("qoi_test_images/dice.qoi").unwrap();
|
||||||
|
|||||||
Reference in New Issue
Block a user