[librsvg: 15/23] When a test reference file doesn't exist, panic with a better message
- From: Federico Mena Quintero <federico src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [librsvg: 15/23] When a test reference file doesn't exist, panic with a better message
- Date: Mon, 24 May 2021 17:47:32 +0000 (UTC)
commit bb1bdb6dc3d9ab56d084e462cfaeb8dbe94e31f1
Author: Federico Mena Quintero <federico gnome org>
Date: Fri May 21 19:55:20 2021 -0500
When a test reference file doesn't exist, panic with a better message
Otherwise the plain unwrap() doesn't print what file couldn't be opened.
tests/src/predicates/png.rs | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
---
diff --git a/tests/src/predicates/png.rs b/tests/src/predicates/png.rs
index 22767b2f..e0cf6f6c 100644
--- a/tests/src/predicates/png.rs
+++ b/tests/src/predicates/png.rs
@@ -129,7 +129,8 @@ impl ReferencePredicate<PngPredicate> {
}
fn diff_surface(&self, surface: &SharedImageSurface) -> Option<BufferDiff> {
- let reference = Reference::from_png(&self.path).unwrap();
+ let reference = Reference::from_png(&self.path)
+ .unwrap_or_else(|_| panic!("could not open {:?}", self.path));
if let Ok(diff) = reference.compare(&surface) {
if !Self::diff_acceptable(&diff) {
return Some(diff);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]