mirror of
https://github.com/rojo-rbx/rojo.git
synced 2026-10-23 14:01:37 +00:00
Add guard test for INIT_FILE_PRIORITY vs DEFAULT_PROJECT_NAMES sync
This commit is contained in:
parent
e86ebdadbc
commit
8b18dc451a
1 changed files with 20 additions and 0 deletions
|
|
@ -112,6 +112,10 @@ pub fn snapshot_from_vfs(
|
|||
/// Single source of truth for init-file resolution priority.
|
||||
/// Project files are checked first, then init files in this order.
|
||||
/// Used by both `get_dir_middleware` (live) and `prefetch_project_files` (cache).
|
||||
///
|
||||
/// NOTE: The project file entries must match `DEFAULT_PROJECT_NAMES` in
|
||||
/// `project.rs`. The `init_file_priority_includes_all_project_names` test
|
||||
/// guards against drift.
|
||||
pub static INIT_FILE_PRIORITY: &[(Middleware, &str)] = &[
|
||||
(Middleware::Project, "default.project.json5"),
|
||||
(Middleware::Project, "default.project.json"),
|
||||
|
|
@ -526,6 +530,22 @@ mod test {
|
|||
|
||||
use memofs::{InMemoryFs, VfsSnapshot};
|
||||
|
||||
#[test]
|
||||
fn init_file_priority_includes_all_project_names() {
|
||||
use crate::project::DEFAULT_PROJECT_NAMES;
|
||||
let priority_names: Vec<&str> = INIT_FILE_PRIORITY
|
||||
.iter()
|
||||
.filter(|(m, _)| *m == Middleware::Project)
|
||||
.map(|(_, name)| *name)
|
||||
.collect();
|
||||
for project_name in DEFAULT_PROJECT_NAMES {
|
||||
assert!(
|
||||
priority_names.contains(&project_name),
|
||||
"DEFAULT_PROJECT_NAMES entry {project_name:?} missing from INIT_FILE_PRIORITY"
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn is_script_covers_all_script_types() {
|
||||
assert!(Middleware::ServerScript.is_script());
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue