test(automation): read UI_SET_FIELDS from control/params.rs

The ui-egui control.rs split moved the UI_SET_FIELDS declaration to control/params.rs; the MCP test reads it from source by path.
This commit is contained in:
aiongg
2026-10-26 22:54:54 +00:00
parent 91d6c24807
commit f07a484fb7
+3 -2
View File
@@ -273,12 +273,13 @@ async fn command_ids_in_tool_schemas_exist() {
client.cancel().await.unwrap();
}
/// `UI_SET_FIELDS` in `crates/ui-egui/src/control.rs`, read from source. The desktop shell owns the
/// `UI_SET_FIELDS` in `crates/ui-egui/src/control/params.rs`, read from source. The desktop shell owns the
/// list; this crate describes it over MCP without depending on the UI crate (both are L6).
/// Anchored on the declaration, not on the doc comment that mentions it first, and checked against
/// the declared array length so a mis-parse fails loudly instead of testing the wrong names.
fn ui_set_fields() -> Vec<String> {
let src = std::fs::read_to_string(std::path::Path::new(env!("CARGO_MANIFEST_DIR")).join("../ui-egui/src/control.rs")).expect("ui-egui control.rs");
let src =
std::fs::read_to_string(std::path::Path::new(env!("CARGO_MANIFEST_DIR")).join("../ui-egui/src/control/params.rs")).expect("ui-egui control/params.rs");
let (_, rest) = src.split_once("UI_SET_FIELDS: [&str; ").expect("UI_SET_FIELDS is declared");
let declared: usize = rest.split_once(']').expect("declared length").0.parse().expect("declared length");
let body = rest.split_once('[').expect("field array").1.split_once("];").expect("terminated array").0;