Add DuplicateImage validation error variant
change vyymlowyslnnkkplzuquxmtllolwuxnx
commit 4d23aef6ae1333885ed496338c1b2e894f463757
author Alpha Chen <alpha@kejadlen.dev>
date
parent zyyoxuuw
diff --git a/src/ci/pipeline.rs b/src/ci/pipeline.rs
index 187985c..9b5add8 100644
--- a/src/ci/pipeline.rs
+++ b/src/ci/pipeline.rs
@@ -269,6 +269,12 @@ pub enum ValidationError {
         #[label("declared here")]
         span: SourceSpan,
     },
+
+    #[error("Pipeline image declared more than once.")]
+    DuplicateImage {
+        #[label("duplicate image declaration")]
+        span: SourceSpan,
+    },
 }
 
 /// All validation errors produced while loading a ci.fnl, paired with
@@ -665,6 +671,14 @@ mod tests {
         assert!(!map["only"].contains("only"), "self should not be in set");
     }
 
+    #[test]
+    fn duplicate_image_variant_exists() {
+        let err = ValidationError::DuplicateImage {
+            span: SourceSpan::from((0, 0)),
+        };
+        assert!(err.to_string().contains("image"));
+    }
+
     #[test]
     fn load_reports_both_parse_and_post_graph_errors() {
         // `setup` has empty inputs (pre-graph error) and `orphan` is unreachable