From 9abdf468b1fb6a48c4f0c42f7f47dfb71c075827 Mon Sep 17 00:00:00 2001 From: realaravinth Date: Thu, 8 Apr 2021 20:14:53 +0530 Subject: [PATCH] try hash test --- src/hash.rs | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/src/hash.rs b/src/hash.rs index 53032ff..49fe8f5 100644 --- a/src/hash.rs +++ b/src/hash.rs @@ -214,4 +214,33 @@ mod tests { assert_eq!(src.exists(), dest.exists()); } } + + #[test] + fn try_hash_works() { + let types = vec![ + mime::IMAGE_PNG, + mime::IMAGE_SVG, + mime::IMAGE_JPEG, + mime::IMAGE_GIF, + ]; + + let config = BusterBuilder::default() + .source("./dist") + .result("/tmp/prod") + .mime_types(types) + .copy(true) + .follow_links(true) + .build() + .unwrap(); + + config.init().unwrap(); + let mut map = config.hash().unwrap(); + + for (k, v) in map.drain() { + let src = Path::new(&k); + let dest = Path::new(&v); + + assert_eq!(src.exists(), dest.exists()); + } + } }