diff options
| author | jacksonfu14 <jackson@fashionunited.com> | 2025-11-14 18:22:21 +0100 |
|---|---|---|
| committer | Jackson Moore <jacksonmoore@tuta.io> | 2025-11-14 18:22:21 +0100 |
| commit | 6aeb5a91c42446b5ea68ec81dd01079a74787c96 (patch) | |
| tree | 4de217802fc9701ca1a0dbb08685972885264ee8 /morphology-img/tests/error.rs | |
| parent | 30e48fe5083db3f83d68c830fb43c6a7a955a99c (diff) | |
feature: add morphology rendering module
Diffstat (limited to 'morphology-img/tests/error.rs')
| -rw-r--r-- | morphology-img/tests/error.rs | 32 |
1 files changed, 32 insertions, 0 deletions
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(_))); +} |