diff --git a/git-version-macro/Cargo.toml b/git-version-macro/Cargo.toml index 53900f4..a8fd5ad 100644 --- a/git-version-macro/Cargo.toml +++ b/git-version-macro/Cargo.toml @@ -22,3 +22,6 @@ proc-macro = true quote = "1.0" proc-macro2 = "1.0" syn = "2.0" + +[dev-dependencies] +assert2 = "0.3.11" diff --git a/git-version-macro/src/utils.rs b/git-version-macro/src/utils.rs index 10a4a53..abaa168 100644 --- a/git-version-macro/src/utils.rs +++ b/git-version-macro/src/utils.rs @@ -47,11 +47,12 @@ pub fn git_dir_cwd() -> std::io::Result { #[test] fn test_git_dir() { use std::path::Path; + use assert2::{assert, let_assert}; - assert_eq!( - git_dir_cwd().unwrap().canonicalize().unwrap(), - Path::new(env!("CARGO_MANIFEST_DIR")).join("../.git").canonicalize().unwrap() - ); + let_assert!(Ok(git_dir) = git_dir_cwd()); + let_assert!(Ok(git_dir) = git_dir.canonicalize()); + let_assert!(Ok(expected) = Path::new(env!("CARGO_MANIFEST_DIR")).join("../.git").canonicalize()); + assert!(git_dir == expected); } /// Check if a command ran successfully, and if not, return a verbose error.