mirror of
https://github.com/storytold/photocraft.git
synced 2026-10-28 02:02:04 +01:00
Every tests/*.rs file is its own executable that links the whole crate graph. Move each crate's test files into tests/it/ as modules of one tests/it/main.rs; helper modules under tests/common move with them. These keep their own binary (own process): - engine panic_hunt: a process-wide panic hook counts every panic. - engine text_gamma: changes the process-wide text gamma. - engine smart_filter_stages, mask_cache_purge: assert on global caches. - codecs pnm_peak_memory: reads the process's peak RSS. - photocraft mac_menu_appkit: harness = false.
18 lines
756 B
Rust
18 lines
756 B
Rust
//! Index lookups must return the same spec, in the same order, as the registry's public slice.
|
|
use photocraft_engine::commands;
|
|
|
|
#[test]
|
|
fn every_lookup_matches_the_first_linear_match() {
|
|
let specs = commands::command_specs();
|
|
for spec in specs {
|
|
let linear = specs.iter().find(|s| s.id == spec.id).unwrap();
|
|
assert!(std::ptr::eq(commands::find(spec.id).unwrap(), linear), "{}", spec.id);
|
|
// The id need not be a static string: control/MCP dispatch owns its input.
|
|
let owned = spec.id.to_string();
|
|
assert!(std::ptr::eq(commands::find(&owned).unwrap(), linear));
|
|
}
|
|
for id in ["", "missing.command", "FILE.NEW", "file.new\0", "💾"] {
|
|
assert!(commands::find(id).is_none(), "{id:?}");
|
|
}
|
|
}
|