2022-08-28 12:43:14 +00:00
|
|
|
//! Test that a constant `tracked` fn (has no inputs)
|
|
|
|
//! compiles and executes successfully.
|
|
|
|
#![allow(warnings)]
|
|
|
|
|
2022-09-03 15:55:31 +00:00
|
|
|
#[salsa::tracked]
|
2024-07-17 10:41:56 +00:00
|
|
|
fn tracked_fn(db: &dyn salsa::Database) -> u32 {
|
2022-08-28 12:43:14 +00:00
|
|
|
44
|
|
|
|
}
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn execute() {
|
2024-07-17 10:41:56 +00:00
|
|
|
#[salsa::db]
|
2022-08-28 12:43:14 +00:00
|
|
|
#[derive(Default)]
|
|
|
|
struct Database {
|
|
|
|
storage: salsa::Storage<Self>,
|
|
|
|
}
|
|
|
|
|
2024-07-17 10:41:56 +00:00
|
|
|
#[salsa::db]
|
2022-08-28 12:43:14 +00:00
|
|
|
impl salsa::Database for Database {}
|
|
|
|
|
|
|
|
let mut db = Database::default();
|
|
|
|
assert_eq!(tracked_fn(&db), 44);
|
|
|
|
}
|