Now returning duplicate database errors.
This commit is contained in:
@ -146,6 +146,24 @@ mod mtt {
|
||||
let output = mtt1.session().await.unwrap();
|
||||
assert_eq!(output.list(), [db1, db2]);
|
||||
}
|
||||
|
||||
#[async_std::test]
|
||||
async fn fail_on_duplicates() {
|
||||
let dir = tempdir().unwrap();
|
||||
let mtt1 = start_db(dir.path()).await.unwrap();
|
||||
let mtt2 = mtt1.clone();
|
||||
let name = "unique_only";
|
||||
let mut store1 = mtt1.session().await.unwrap();
|
||||
let mut store2 = mtt2.session().await.unwrap();
|
||||
store1.add(name).unwrap();
|
||||
store2.add(name).unwrap();
|
||||
mtt1.commit(store1).await.unwrap();
|
||||
let output = mtt2.commit(store2).await;
|
||||
match output {
|
||||
Ok(_) => assert!(false, "Should have returned an error"),
|
||||
Err(_) => (),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub async fn start_db<P>(dir: P) -> Result<MoreThanText, MTTError>
|
||||
|
Reference in New Issue
Block a user