salsa/tests/tracked_fn_constant.rs

29 lines
549 B
Rust
Raw Normal View History

//! Test that a constant `tracked` fn (has no inputs)
//! compiles and executes successfully.
#![allow(warnings)]
2024-08-20 19:34:38 +00:00
use crate::common::LogDatabase;
mod common;
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 {
44
}
2024-08-20 19:34:38 +00:00
#[salsa::tracked]
fn tracked_custom_db(db: &dyn LogDatabase) -> u32 {
44
}
#[test]
fn execute() {
let mut db = salsa::DatabaseImpl::new();
assert_eq!(tracked_fn(&db), 44);
}
2024-08-20 19:34:38 +00:00
#[test]
fn execute_custom() {
let mut db = common::LoggerDatabase::new();
assert_eq!(tracked_custom_db(&db), 44);
}