mirror of
https://github.com/salsa-rs/salsa.git
synced 2025-01-22 21:05:11 +00:00
don't mark specified values as volatile
This is what we want, but it's not a complete fix. It does make these tests work, though! Good enough to commit.
This commit is contained in:
parent
eeb47a065c
commit
d72803c027
3 changed files with 43 additions and 44 deletions
|
@ -50,7 +50,7 @@ where
|
|||
// - a result that is verified in the current revision, because it was set, which will use the set value
|
||||
// - a result that is NOT verified and has untracked inputs, which will re-execute (and likely panic)
|
||||
let inputs = QueryInputs {
|
||||
untracked: true,
|
||||
untracked: false,
|
||||
tracked: runtime.empty_dependencies(),
|
||||
};
|
||||
|
||||
|
|
|
@ -84,27 +84,27 @@ fn execute() {
|
|||
]"#]]);
|
||||
}
|
||||
|
||||
// /// Create and mutate a distinct input. No re-execution required.
|
||||
// #[test]
|
||||
// fn red_herring() {
|
||||
// let mut db = Database::default();
|
||||
/// Create and mutate a distinct input. No re-execution required.
|
||||
#[test]
|
||||
fn red_herring() {
|
||||
let mut db = Database::default();
|
||||
|
||||
// let input = MyInput::new(&mut db, 22);
|
||||
// assert_eq!(final_result(&db, input), 22);
|
||||
// db.assert_logs(expect![[r#"
|
||||
// [
|
||||
// "final_result(MyInput(Id { value: 1 }))",
|
||||
// "intermediate_result(MyInput(Id { value: 1 }))",
|
||||
// ]"#]]);
|
||||
let input = MyInput::new(&mut db, 22);
|
||||
assert_eq!(final_result(&db, input), 22);
|
||||
db.assert_logs(expect![[r#"
|
||||
[
|
||||
"final_result(MyInput(Id { value: 1 }))",
|
||||
"intermediate_result(MyInput(Id { value: 1 }))",
|
||||
]"#]]);
|
||||
|
||||
// // Create a distinct input and mutate it.
|
||||
// // This will trigger a new revision in the database
|
||||
// // but shouldn't actually invalidate our existing ones.
|
||||
// let input2 = MyInput::new(&mut db, 44);
|
||||
// input2.set_field(&mut db, 66);
|
||||
// Create a distinct input and mutate it.
|
||||
// This will trigger a new revision in the database
|
||||
// but shouldn't actually invalidate our existing ones.
|
||||
let input2 = MyInput::new(&mut db, 44);
|
||||
input2.set_field(&mut db, 66);
|
||||
|
||||
// // Re-run the query on the original input. Nothing re-executes!
|
||||
// assert_eq!(final_result(&db, input), 22);
|
||||
// db.assert_logs(expect![[r#"
|
||||
// []"#]]);
|
||||
// }
|
||||
// Re-run the query on the original input. Nothing re-executes!
|
||||
assert_eq!(final_result(&db, input), 22);
|
||||
db.assert_logs(expect![[r#"
|
||||
[]"#]]);
|
||||
}
|
||||
|
|
|
@ -85,28 +85,27 @@ fn one_entity() {
|
|||
]"#]]);
|
||||
}
|
||||
|
||||
// /// Create and mutate a distinct input. No re-execution required.
|
||||
// #[test]
|
||||
// fn red_herring() {
|
||||
// let mut db = Database::default();
|
||||
/// Create and mutate a distinct input. No re-execution required.
|
||||
#[test]
|
||||
fn red_herring() {
|
||||
let mut db = Database::default();
|
||||
|
||||
// let input = MyInput::new(&mut db, 22);
|
||||
// assert_eq!(final_result(&db, input), 22);
|
||||
// db.assert_logs(expect![[r#"
|
||||
// [
|
||||
// "final_result(MyInput(Id { value: 1 }))",
|
||||
// "intermediate_result(MyInput(Id { value: 1 }))",
|
||||
// ]"#]]);
|
||||
let input = MyInput::new(&mut db, 22);
|
||||
assert_eq!(final_result(&db, input), 22);
|
||||
db.assert_logs(expect![[r#"
|
||||
[
|
||||
"final_result(MyInput(Id { value: 1 }))",
|
||||
"intermediate_result(MyInput(Id { value: 1 }))",
|
||||
]"#]]);
|
||||
|
||||
// // Create a distinct input and mutate it.
|
||||
// // This will trigger a new revision in the database
|
||||
// // but shouldn't actually invalidate our existing ones.
|
||||
// let input2 = MyInput::new(&mut db, 44);
|
||||
// input2.set_field(&mut db, 66);
|
||||
// Create a distinct input and mutate it.
|
||||
// This will trigger a new revision in the database
|
||||
// but shouldn't actually invalidate our existing ones.
|
||||
let input2 = MyInput::new(&mut db, 44);
|
||||
input2.set_field(&mut db, 66);
|
||||
|
||||
// // Re-run the query on the original input. Nothing re-executes!
|
||||
// assert_eq!(final_result(&db, input), 22);
|
||||
// db.assert_logs(expect![[r#"
|
||||
// [
|
||||
// ]"#]]);
|
||||
// }
|
||||
// Re-run the query on the original input. Nothing re-executes!
|
||||
assert_eq!(final_result(&db, input), 22);
|
||||
db.assert_logs(expect![[r#"
|
||||
[]"#]]);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue