This commit is contained in:
Niko Matsakis 2024-07-19 08:10:23 -04:00
parent ad61687e83
commit 6a3afba141
2 changed files with 14 additions and 14 deletions

View file

@ -60,8 +60,8 @@ fn execute() {
assert_eq!(final_result(&db, input), 22); assert_eq!(final_result(&db, input), 22);
db.assert_logs(expect![[r#" db.assert_logs(expect![[r#"
[ [
"final_result(MyInput { [salsa id]: 0 })", "final_result(MyInput { [salsa id]: 0, field: 22 })",
"intermediate_result(MyInput { [salsa id]: 0 })", "intermediate_result(MyInput { [salsa id]: 0, field: 22 })",
]"#]]); ]"#]]);
// Intermediate result is the same, so final result does // Intermediate result is the same, so final result does
@ -70,15 +70,15 @@ fn execute() {
assert_eq!(final_result(&db, input), 22); assert_eq!(final_result(&db, input), 22);
db.assert_logs(expect![[r#" db.assert_logs(expect![[r#"
[ [
"intermediate_result(MyInput { [salsa id]: 0 })", "intermediate_result(MyInput { [salsa id]: 0, field: 23 })",
]"#]]); ]"#]]);
input.set_field(&mut db).to(24); input.set_field(&mut db).to(24);
assert_eq!(final_result(&db, input), 24); assert_eq!(final_result(&db, input), 24);
db.assert_logs(expect![[r#" db.assert_logs(expect![[r#"
[ [
"intermediate_result(MyInput { [salsa id]: 0 })", "intermediate_result(MyInput { [salsa id]: 0, field: 24 })",
"final_result(MyInput { [salsa id]: 0 })", "final_result(MyInput { [salsa id]: 0, field: 24 })",
]"#]]); ]"#]]);
} }
@ -91,8 +91,8 @@ fn red_herring() {
assert_eq!(final_result(&db, input), 22); assert_eq!(final_result(&db, input), 22);
db.assert_logs(expect![[r#" db.assert_logs(expect![[r#"
[ [
"final_result(MyInput { [salsa id]: 0 })", "final_result(MyInput { [salsa id]: 0, field: 22 })",
"intermediate_result(MyInput { [salsa id]: 0 })", "intermediate_result(MyInput { [salsa id]: 0, field: 22 })",
]"#]]); ]"#]]);
// Create a distinct input and mutate it. // Create a distinct input and mutate it.

View file

@ -61,8 +61,8 @@ fn one_entity() {
assert_eq!(final_result(&db, input), 22); assert_eq!(final_result(&db, input), 22);
db.assert_logs(expect![[r#" db.assert_logs(expect![[r#"
[ [
"final_result(MyInput { [salsa id]: 0 })", "final_result(MyInput { [salsa id]: 0, field: 22 })",
"intermediate_result(MyInput { [salsa id]: 0 })", "intermediate_result(MyInput { [salsa id]: 0, field: 22 })",
]"#]]); ]"#]]);
// Intermediate result is the same, so final result does // Intermediate result is the same, so final result does
@ -71,15 +71,15 @@ fn one_entity() {
assert_eq!(final_result(&db, input), 22); assert_eq!(final_result(&db, input), 22);
db.assert_logs(expect![[r#" db.assert_logs(expect![[r#"
[ [
"intermediate_result(MyInput { [salsa id]: 0 })", "intermediate_result(MyInput { [salsa id]: 0, field: 23 })",
]"#]]); ]"#]]);
input.set_field(&mut db).to(24); input.set_field(&mut db).to(24);
assert_eq!(final_result(&db, input), 24); assert_eq!(final_result(&db, input), 24);
db.assert_logs(expect![[r#" db.assert_logs(expect![[r#"
[ [
"intermediate_result(MyInput { [salsa id]: 0 })", "intermediate_result(MyInput { [salsa id]: 0, field: 24 })",
"final_result(MyInput { [salsa id]: 0 })", "final_result(MyInput { [salsa id]: 0, field: 24 })",
]"#]]); ]"#]]);
} }
@ -92,8 +92,8 @@ fn red_herring() {
assert_eq!(final_result(&db, input), 22); assert_eq!(final_result(&db, input), 22);
db.assert_logs(expect![[r#" db.assert_logs(expect![[r#"
[ [
"final_result(MyInput { [salsa id]: 0 })", "final_result(MyInput { [salsa id]: 0, field: 22 })",
"intermediate_result(MyInput { [salsa id]: 0 })", "intermediate_result(MyInput { [salsa id]: 0, field: 22 })",
]"#]]); ]"#]]);
// Create a distinct input and mutate it. // Create a distinct input and mutate it.