将Index改为单例模式,防止状态不一致; 注意:测试为单进程,需要reset防止共享单例

This commit is contained in:
mrbeanc
2023-12-27 16:19:02 +08:00
parent 228e1d681e
commit b568e87925
10 changed files with 67 additions and 37 deletions

View File

@@ -88,7 +88,7 @@ mod test {
fn test_commit() {
util::setup_test_with_clean_mit();
let index = super::Index::new();
let index = super::Index::get_instance();
let mut commit = super::Commit::new(&index, vec!["123".to_string(), "456".to_string()], "test".to_string());
assert_eq!(commit.hash.len(), 0);