Merge pull request #5867 from guanqun/small-fixes

ArchiveDB and other small fixes
This commit is contained in:
Robert Habermeier 2017-06-19 14:03:48 +02:00 committed by GitHub
commit bedce59a6f
3 changed files with 17 additions and 1 deletions

View File

@ -296,6 +296,7 @@ mod test {
assert!(check_vault_name("vault_with_underscores")); assert!(check_vault_name("vault_with_underscores"));
assert!(check_vault_name("vault-with-dashes")); assert!(check_vault_name("vault-with-dashes"));
assert!(check_vault_name("vault-with-digits-123")); assert!(check_vault_name("vault-with-digits-123"));
assert!(check_vault_name("vault中文名字"));
} }
#[test] #[test]

View File

@ -239,6 +239,21 @@ mod tests {
jdb.commit_batch(3, &b"3".sha3(), Some((0, b"0".sha3()))).unwrap(); jdb.commit_batch(3, &b"3".sha3(), Some((0, b"0".sha3()))).unwrap();
assert!(jdb.contains(&h)); assert!(jdb.contains(&h));
jdb.commit_batch(4, &b"4".sha3(), Some((1, b"1".sha3()))).unwrap(); jdb.commit_batch(4, &b"4".sha3(), Some((1, b"1".sha3()))).unwrap();
assert!(jdb.contains(&h));
}
#[test]
#[should_panic]
fn multiple_owed_removal_not_allowed() {
let mut jdb = ArchiveDB::new_temp();
let h = jdb.insert(b"foo");
jdb.commit_batch(0, &b"0".sha3(), None).unwrap();
assert!(jdb.contains(&h));
jdb.remove(&h);
jdb.remove(&h);
// commit_batch would call journal_under(),
// and we don't allow multiple owned removals.
jdb.commit_batch(1, &b"1".sha3(), None).unwrap();
} }
#[test] #[test]