ArchiveDB: add a new test case

This commit is contained in:
Guanqun Lu 2017-06-10 00:23:25 +08:00
parent 7f07f7d567
commit a5531e83fd

View File

@ -242,6 +242,20 @@ mod tests {
assert!(jdb.contains(&h)); 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]
fn complex() { fn complex() {
// history is 1 // history is 1