mirror of
https://github.com/salsa-rs/salsa.git
synced 2025-02-08 21:35:47 +00:00
add (failing) test that checks that we clear query stack
This commit is contained in:
parent
21519e6ff7
commit
27af8ca820
1 changed files with 14 additions and 0 deletions
|
@ -64,3 +64,17 @@ fn storages_are_unwind_safe() {
|
||||||
fn check_unwind_safe<T: std::panic::UnwindSafe>() {}
|
fn check_unwind_safe<T: std::panic::UnwindSafe>() {}
|
||||||
check_unwind_safe::<&DatabaseStruct>();
|
check_unwind_safe::<&DatabaseStruct>();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn panics_clear_query_stack() {
|
||||||
|
let db = DatabaseStruct::default();
|
||||||
|
|
||||||
|
// Invoke `db.panic_if_not_one() without having set `db.input`. `db.input`
|
||||||
|
// will default to 0 and we should catch the panic.
|
||||||
|
let result = panic::catch_unwind(AssertUnwindSafe(|| db.panic_safely()));
|
||||||
|
assert!(result.is_err());
|
||||||
|
|
||||||
|
// The database has been poisoned and any attempt to increment the
|
||||||
|
// revision should panic.
|
||||||
|
assert_eq!(db.salsa_runtime().active_query(), None);
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue