Skip to content

Commit

Permalink
Update test snapshots after rebase
Browse files Browse the repository at this point in the history
  • Loading branch information
MichaReiser committed Jun 23, 2024
1 parent df5f563 commit ff0bcd6
Show file tree
Hide file tree
Showing 14 changed files with 91 additions and 85 deletions.
8 changes: 3 additions & 5 deletions tests/debug.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,7 @@ fn input() {

// debug includes all fields
let actual = format!("{:?}", complex_struct.debug(&db));
let expected = expect![[
r#"ComplexStruct { [salsa id]: 0, my_input: MyInput { [salsa id]: 0, field: 22 }, not_salsa: NotSalsa { field: "it's salsa time" } }"#
]];
let expected = expect![[r#"ComplexStruct { [salsa id]: Id(0), my_input: MyInput { [salsa id]: Id(0), field: 22 }, not_salsa: NotSalsa { field: "it's salsa time" } }"#]];
expected.assert_eq(&actual);
}

Expand All @@ -74,7 +72,7 @@ fn untracked_dependencies() {

let s = leak_debug_string(&db, input);
expect![[r#"
"MyInput { [salsa id]: 0, field: 22 }"
"MyInput { [salsa id]: Id(0), field: 22 }"
"#]]
.assert_debug_eq(&s);

Expand Down Expand Up @@ -118,7 +116,7 @@ fn custom_debug_impl() {

let s = leak_derived_custom(&db, input, 23);
expect![[r#"
"MyInput { [salsa id]: 0, field: 22 } / 23"
"MyInput { [salsa id]: Id(0), field: 22 } / 23"
"#]]
.assert_debug_eq(&s);
}
8 changes: 4 additions & 4 deletions tests/deletion-cascade.rs
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,8 @@ fn basic() {
assert_eq!(final_result(&db, input), 2 * 2 + 2);
db.assert_logs(expect![[r#"
[
"final_result(MyInput { [salsa id]: 0 })",
"intermediate_result(MyInput { [salsa id]: 0 })",
"final_result(MyInput { [salsa id]: Id(0) })",
"intermediate_result(MyInput { [salsa id]: Id(0) })",
]"#]]);

// Creates only 2 tracked structs in this revision, should delete 1
Expand All @@ -118,12 +118,12 @@ fn basic() {
assert_eq!(final_result(&db, input), 2);
db.assert_logs(expect![[r#"
[
"intermediate_result(MyInput { [salsa id]: 0 })",
"intermediate_result(MyInput { [salsa id]: Id(0) })",
"salsa_event(WillDiscardStaleOutput { execute_key: create_tracked_structs(0), output_key: MyTracked(2) })",
"salsa_event(DidDiscard { key: MyTracked(2) })",
"salsa_event(DidDiscard { key: contribution_from_struct(2) })",
"salsa_event(DidDiscard { key: MyTracked(5) })",
"salsa_event(DidDiscard { key: copy_field(5) })",
"final_result(MyInput { [salsa id]: 0 })",
"final_result(MyInput { [salsa id]: Id(0) })",
]"#]]);
}
8 changes: 4 additions & 4 deletions tests/deletion.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,8 @@ fn basic() {
assert_eq!(final_result(&db, input), 2 * 2 + 2);
db.assert_logs(expect![[r#"
[
"final_result(MyInput { [salsa id]: 0 })",
"intermediate_result(MyInput { [salsa id]: 0 })",
"final_result(MyInput { [salsa id]: Id(0) })",
"intermediate_result(MyInput { [salsa id]: Id(0) })",
]"#]]);

// Creates only 2 tracked structs in this revision, should delete 1
Expand All @@ -104,10 +104,10 @@ fn basic() {
assert_eq!(final_result(&db, input), 2);
db.assert_logs(expect![[r#"
[
"intermediate_result(MyInput { [salsa id]: 0 })",
"intermediate_result(MyInput { [salsa id]: Id(0) })",
"salsa_event(WillDiscardStaleOutput { execute_key: create_tracked_structs(0), output_key: MyTracked(2) })",
"salsa_event(DidDiscard { key: MyTracked(2) })",
"salsa_event(DidDiscard { key: contribution_from_struct(2) })",
"final_result(MyInput { [salsa id]: 0 })",
"final_result(MyInput { [salsa id]: Id(0) })",
]"#]]);
}
10 changes: 5 additions & 5 deletions tests/elided-lifetime-in-tracked-fn.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,8 @@ fn execute() {
assert_eq!(final_result(&db, input), 22);
db.assert_logs(expect![[r#"
[
"final_result(MyInput { [salsa id]: 0 })",
"intermediate_result(MyInput { [salsa id]: 0 })",
"final_result(MyInput { [salsa id]: Id(0) })",
"intermediate_result(MyInput { [salsa id]: Id(0) })",
]"#]]);

// Intermediate result is the same, so final result does
Expand All @@ -69,14 +69,14 @@ fn execute() {
assert_eq!(final_result(&db, input), 22);
db.assert_logs(expect![[r#"
[
"intermediate_result(MyInput { [salsa id]: 0 })",
"intermediate_result(MyInput { [salsa id]: Id(0) })",
]"#]]);

input.set_field(&mut db).to(24);
assert_eq!(final_result(&db, input), 24);
db.assert_logs(expect![[r#"
[
"intermediate_result(MyInput { [salsa id]: 0 })",
"final_result(MyInput { [salsa id]: 0 })",
"intermediate_result(MyInput { [salsa id]: Id(0) })",
"final_result(MyInput { [salsa id]: Id(0) })",
]"#]]);
}
Original file line number Diff line number Diff line change
Expand Up @@ -79,13 +79,13 @@ fn execute() {
assert_eq!(final_result_depends_on_x(&db, input), 22);
db.assert_logs(expect![[r#"
[
"final_result_depends_on_x(MyInput { [salsa id]: 0 })",
"final_result_depends_on_x(MyInput { [salsa id]: Id(0) })",
]"#]]);

assert_eq!(final_result_depends_on_y(&db, input), 22);
db.assert_logs(expect![[r#"
[
"final_result_depends_on_y(MyInput { [salsa id]: 0 })",
"final_result_depends_on_y(MyInput { [salsa id]: Id(0) })",
]"#]]);

input.set_field(&mut db).to(23);
Expand All @@ -95,7 +95,7 @@ fn execute() {
assert_eq!(final_result_depends_on_x(&db, input), 24);
db.assert_logs(expect![[r#"
[
"final_result_depends_on_x(MyInput { [salsa id]: 0 })",
"final_result_depends_on_x(MyInput { [salsa id]: Id(0) })",
]"#]]);

// y = 23 / 2 = 11
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,21 +58,21 @@ fn execute() {
assert_eq!(result_depends_on_x(&db, input), 23);
db.assert_logs(expect![[r#"
[
"result_depends_on_x(MyInput { [salsa id]: 0 })",
"result_depends_on_x(MyInput { [salsa id]: Id(0) })",
]"#]]);

assert_eq!(result_depends_on_y(&db, input), 32);
db.assert_logs(expect![[r#"
[
"result_depends_on_y(MyInput { [salsa id]: 0 })",
"result_depends_on_y(MyInput { [salsa id]: Id(0) })",
]"#]]);

input.set_x(&mut db).to(23);
// input x changes, so result depends on x needs to be recomputed;
assert_eq!(result_depends_on_x(&db, input), 24);
db.assert_logs(expect![[r#"
[
"result_depends_on_x(MyInput { [salsa id]: 0 })",
"result_depends_on_x(MyInput { [salsa id]: Id(0) })",
]"#]]);

// input y is the same, so result depends on y
Expand Down
14 changes: 7 additions & 7 deletions tests/hello_world.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,8 @@ fn execute() {
assert_eq!(final_result(&db, input), 22);
db.assert_logs(expect![[r#"
[
"final_result(MyInput { [salsa id]: 0 })",
"intermediate_result(MyInput { [salsa id]: 0 })",
"final_result(MyInput { [salsa id]: Id(0) })",
"intermediate_result(MyInput { [salsa id]: Id(0) })",
]"#]]);

// Intermediate result is the same, so final result does
Expand All @@ -69,15 +69,15 @@ fn execute() {
assert_eq!(final_result(&db, input), 22);
db.assert_logs(expect![[r#"
[
"intermediate_result(MyInput { [salsa id]: 0 })",
"intermediate_result(MyInput { [salsa id]: Id(0) })",
]"#]]);

input.set_field(&mut db).to(24);
assert_eq!(final_result(&db, input), 24);
db.assert_logs(expect![[r#"
[
"intermediate_result(MyInput { [salsa id]: 0 })",
"final_result(MyInput { [salsa id]: 0 })",
"intermediate_result(MyInput { [salsa id]: Id(0) })",
"final_result(MyInput { [salsa id]: Id(0) })",
]"#]]);
}

Expand All @@ -90,8 +90,8 @@ fn red_herring() {
assert_eq!(final_result(&db, input), 22);
db.assert_logs(expect![[r#"
[
"final_result(MyInput { [salsa id]: 0 })",
"intermediate_result(MyInput { [salsa id]: 0 })",
"final_result(MyInput { [salsa id]: Id(0) })",
"intermediate_result(MyInput { [salsa id]: Id(0) })",
]"#]]);

// Create a distinct input and mutate it.
Expand Down
2 changes: 1 addition & 1 deletion tests/input_with_ids.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ fn test_debug() {
let input = MyInput::new(&mut db, 50, 10, Field {});

let actual = format!("{:?}", input.debug(&db));
let expected = expect!["MyInput { [salsa id]: 0, id_one: 50, id_two: 10, field: Field }"];
let expected = expect!["MyInput { [salsa id]: Id(0), id_one: 50, id_two: 10, field: Field }"];
expected.assert_eq(&actual);
}

Expand Down
2 changes: 1 addition & 1 deletion tests/interned-struct-with-lifetime.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ fn execute() {
let mut db = Database::default();

expect![[r#"
"InternedPair { [salsa id]: 0, data: (InternedString { [salsa id]: 0, data: \"Hello, \" }, InternedString { [salsa id]: 1, data: \"World, \" }) }"
"InternedPair { [salsa id]: Id(0), data: (InternedString { [salsa id]: Id(0), data: \"Hello, \" }, InternedString { [salsa id]: Id(1), data: \"World, \" }) }"
"#]].assert_debug_eq(&intern_stuff(&db));
db.assert_logs(expect!["[]"]);
}
2 changes: 1 addition & 1 deletion tests/singleton.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,6 @@ fn debug() {
let db = Database::default();
let input = MyInput::new(&db, 3, 4);
let actual = format!("{:?}", input.debug(&db));
let expected = expect!["MyInput { [salsa id]: 0, field: 3, id_field: 4 }"];
let expected = expect!["MyInput { [salsa id]: Id(0), field: 3, id_field: 4 }"];
expected.assert_eq(&actual);
}
Loading

0 comments on commit ff0bcd6

Please sign in to comment.