aboutsummaryrefslogtreecommitdiff
path: root/src/file_handler/file_strategies/layout.rs
diff options
context:
space:
mode:
authorRuben Beltran del Rio <git@r.bdr.sh>2025-04-05 14:43:19 +0200
committerRuben Beltran del Rio <git@r.bdr.sh>2025-04-05 14:43:19 +0200
commit93c0e8ecee430883c62120f9f0b6999acfac4435 (patch)
tree785b9275d9dd525889bfb8cb687a41260ae39b16 /src/file_handler/file_strategies/layout.rs
parentbb3ec6b31f3c709fbf9f2a12c1708d63a61892ff (diff)
Update, panic less and propagate errors
Diffstat (limited to 'src/file_handler/file_strategies/layout.rs')
-rw-r--r--src/file_handler/file_strategies/layout.rs29
1 files changed, 21 insertions, 8 deletions
diff --git a/src/file_handler/file_strategies/layout.rs b/src/file_handler/file_strategies/layout.rs
index 9a60f12..45ef665 100644
--- a/src/file_handler/file_strategies/layout.rs
+++ b/src/file_handler/file_strategies/layout.rs
@@ -1,5 +1,6 @@
pub struct Strategy {}
+use std::io::Result;
use std::path::Path;
use crate::file_handler::{File, FileType, Strategy as FileHandlerStrategy};
@@ -19,8 +20,12 @@ impl FileHandlerStrategy for Strategy {
// We don't implement handling for layout, as we assume there's only one
// and it got handled before.
- fn handle_html(&self, _s: &Path, _d: &Path, _f: &File, _l: &str) {}
- fn handle_gemini(&self, _s: &Path, _d: &Path, _f: &File) {}
+ fn handle_html(&self, _s: &Path, _d: &Path, _f: &File, _l: &str) -> Result<()> {
+ Ok(())
+ }
+ fn handle_gemini(&self, _s: &Path, _d: &Path, _f: &File) -> Result<()> {
+ Ok(())
+ }
}
#[cfg(test)]
@@ -101,11 +106,15 @@ mod tests {
file_type: FileType::Layout,
};
- strategy.handle_html(
- &PathBuf::from("source"),
- &PathBuf::from("dest"),
- &file,
- "layout content",
+ assert!(
+ strategy
+ .handle_html(
+ &PathBuf::from("source"),
+ &PathBuf::from("dest"),
+ &file,
+ "layout content",
+ )
+ .is_ok()
);
}
@@ -118,6 +127,10 @@ mod tests {
};
// Should not panic
- strategy.handle_gemini(&PathBuf::from("source"), &PathBuf::from("dest"), &file);
+ assert!(
+ strategy
+ .handle_gemini(&PathBuf::from("source"), &PathBuf::from("dest"), &file)
+ .is_ok()
+ );
}
}