Merge pull request #5867 from guanqun/small-fixes
ArchiveDB and other small fixes
This commit is contained in:
commit
bedce59a6f
@ -477,7 +477,7 @@ mod tests {
|
|||||||
let mut batch = DBTransaction::new();
|
let mut batch = DBTransaction::new();
|
||||||
|
|
||||||
// blocks [ 3a(c) 2a(c) 2b 1b 1a(c) 0 ]
|
// blocks [ 3a(c) 2a(c) 2b 1b 1a(c) 0 ]
|
||||||
// balance [ 5 5 4 3 2 2 ]
|
// balance [ 5 5 4 3 2 2 ]
|
||||||
let mut s = state_db.boxed_clone_canon(&root_parent);
|
let mut s = state_db.boxed_clone_canon(&root_parent);
|
||||||
s.add_to_account_cache(address, Some(Account::new_basic(2.into(), 0.into())), false);
|
s.add_to_account_cache(address, Some(Account::new_basic(2.into(), 0.into())), false);
|
||||||
s.journal_under(&mut batch, 0, &h0).unwrap();
|
s.journal_under(&mut batch, 0, &h0).unwrap();
|
||||||
|
@ -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]
|
||||||
|
@ -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]
|
||||||
|
Loading…
Reference in New Issue
Block a user