summaryrefslogtreecommitdiff
path: root/src/doc.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/doc.rs')
-rw-r--r--src/doc.rs13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/doc.rs b/src/doc.rs
index 640968c..f08f795 100644
--- a/src/doc.rs
+++ b/src/doc.rs
@@ -265,12 +265,25 @@ impl Document {
pub fn lint(&self) -> Result<(), SubplotError> {
trace!("Linting document");
self.check_doc_has_title()?;
+ self.check_scenarios_are_unique()?;
self.check_filenames_are_unique()?;
self.check_block_classes()?;
trace!("No linting problems found");
Ok(())
}
+ // Check that all titles for scenarios are unique.
+ fn check_scenarios_are_unique(&self) -> Result<(), SubplotError> {
+ let mut known = HashSet::new();
+ for title in self.scenarios()?.iter().map(|s| s.title().to_lowercase()) {
+ if known.contains(&title) {
+ return Err(SubplotError::DuplicateScenario(title));
+ }
+ known.insert(title);
+ }
+ Ok(())
+ }
+
// Check that all filenames for embedded files are unique.
fn check_filenames_are_unique(&self) -> Result<(), SubplotError> {
let mut known = HashSet::new();