From 6aeb5a91c42446b5ea68ec81dd01079a74787c96 Mon Sep 17 00:00:00 2001 From: jacksonfu14 Date: Fri, 14 Nov 2025 18:22:21 +0100 Subject: feature: add morphology rendering module --- morphology-img/tests/error.rs | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 morphology-img/tests/error.rs (limited to 'morphology-img/tests/error.rs') diff --git a/morphology-img/tests/error.rs b/morphology-img/tests/error.rs new file mode 100644 index 0000000..3ce808b --- /dev/null +++ b/morphology-img/tests/error.rs @@ -0,0 +1,32 @@ +use morphology_img::RenderError; + +#[test] +fn test_error_display() { + let err = RenderError::LilyPondNotFound("test".to_string()); + assert_eq!(err.to_string(), "LilyPond not found: test"); +} + +#[test] +fn test_lilypond_execution_error() { + let err = RenderError::LilyPondExecution("stderr output".to_string()); + assert_eq!(err.to_string(), "LilyPond execution failed: stderr output"); +} + +#[test] +fn test_template_error() { + let err = RenderError::Template("missing placeholder".to_string()); + assert_eq!(err.to_string(), "Template error: missing placeholder"); +} + +#[test] +fn test_invalid_sequence_error() { + let err = RenderError::InvalidSequence("empty sequence".to_string()); + assert_eq!(err.to_string(), "Invalid sequence: empty sequence"); +} + +#[test] +fn test_io_error_conversion() { + let io_err = std::io::Error::new(std::io::ErrorKind::NotFound, "file not found"); + let err: RenderError = io_err.into(); + assert!(matches!(err, RenderError::FileIO(_))); +} -- cgit v1.2.3