Skip to content

Commit 918bfab

Browse files
Merge pull request #74 from cgwalters/minor-followup
Change test case to match error via types, not strings
2 parents bb0ba4d + 602dcba commit 918bfab

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

src/imageproxy.rs

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -701,11 +701,16 @@ mod tests {
701701
};
702702
config.skopeo_cmd = Some(Command::new("no-skopeo"));
703703

704-
let res = ImageProxy::new_with_config(config).await;
705-
assert!(matches!(res, Err(Error::SkopeoSpawnError(_))));
706-
assert_eq!(
707-
res.err().unwrap().to_string(),
708-
"skopeo spawn error: No such file or directory (os error 2)"
709-
);
704+
match ImageProxy::new_with_config(config).await {
705+
Ok(_) => panic!("Expected an error"),
706+
Err(ref e @ Error::SkopeoSpawnError(ref inner)) => {
707+
assert_eq!(inner.kind(), std::io::ErrorKind::NotFound);
708+
// Just to double check
709+
assert!(e
710+
.to_string()
711+
.contains("skopeo spawn error: No such file or directory"));
712+
}
713+
Err(e) => panic!("Unexpected error {e}"),
714+
}
710715
}
711716
}

0 commit comments

Comments
 (0)