From d34ed1495e72900f891da2e2d7ee8e1bc895c7dc Mon Sep 17 00:00:00 2001 From: Shoyu Vanilla Date: Fri, 15 Nov 2024 01:41:18 +0900 Subject: [PATCH] Add a test for tracked function with multiple salsa struct args --- tests/tracked_fn_multiple_args.rs | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 tests/tracked_fn_multiple_args.rs diff --git a/tests/tracked_fn_multiple_args.rs b/tests/tracked_fn_multiple_args.rs new file mode 100644 index 00000000..7c014356 --- /dev/null +++ b/tests/tracked_fn_multiple_args.rs @@ -0,0 +1,25 @@ +//! Test that a `tracked` fn on multiple salsa struct args +//! compiles and executes successfully. + +#[salsa::input] +struct MyInput { + field: u32, +} + +#[salsa::interned] +struct MyInterned<'db> { + field: u32, +} + +#[salsa::tracked] +fn tracked_fn<'db>(db: &'db dyn salsa::Database, input: MyInput, interned: MyInterned<'db>) -> u32 { + input.field(db) + interned.field(db) +} + +#[test] +fn execute() { + let db = salsa::DatabaseImpl::new(); + let input = MyInput::new(&db, 22); + let interned = MyInterned::new(&db, 33); + assert_eq!(tracked_fn(&db, input, interned), 55); +}