diff --git a/src/models/commit.rs b/src/models/commit.rs index d9d8cf7..89323b3 100644 --- a/src/models/commit.rs +++ b/src/models/commit.rs @@ -86,19 +86,19 @@ mod test { #[test] fn test_commit() { - util::setup_test_with_mit(); + util::setup_test_with_clean_mit(); let index = super::Index::new(); let mut commit = super::Commit::new(&index, vec!["123".to_string(), "456".to_string()], "test".to_string()); - assert!(commit.hash.len() == 0); + assert_eq!(commit.hash.len(), 0); let hash = commit.save(); - assert!(commit.hash == hash, "commit hash not equal"); + assert_eq!(commit.hash, hash, "commit hash not equal"); let commit = super::Commit::load(&hash); - assert!(commit.hash == hash); - assert!(commit.hash.len() != 0); - assert!(commit.parent.len() == 2); + assert_eq!(commit.hash, hash); + assert_ne!(commit.hash.len(), 0); + assert_eq!(commit.parent.len(), 2); println!("{:?}", commit) } } diff --git a/tests/test.rs b/tests/test.rs index 36c2367..777b311 100644 --- a/tests/test.rs +++ b/tests/test.rs @@ -26,6 +26,7 @@ fn test_write() -> Result<(), Error> { fn test_read() -> Result<(), Error> { util::setup_test_with_mit(); let path = "lines.txt"; + util::ensure_test_file(path.as_ref(), None); let input = File::open(path)?; let buffered = BufReader::new(input);