summaryrefslogtreecommitdiff
path: root/morphology-img/tests/error.rs
diff options
context:
space:
mode:
Diffstat (limited to 'morphology-img/tests/error.rs')
-rw-r--r--morphology-img/tests/error.rs32
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(_)));
+}