feat: Add support IPC socket control over menu.
This commit is contained in:
@@ -25,6 +25,7 @@ pub enum TestKind {
|
||||
Filter,
|
||||
Nav,
|
||||
Menu,
|
||||
Ipc,
|
||||
}
|
||||
|
||||
pub struct Fixtures {
|
||||
@@ -58,6 +59,10 @@ pub enum ActionExpr {
|
||||
Raw(String),
|
||||
/// `add-items ["a", "b", "c"]`
|
||||
AddItems(Vec<String>),
|
||||
/// `ipc-send "json line"` — send a JSON command over the IPC socket
|
||||
IpcSend(String),
|
||||
/// `ipc-expect "text"` — read a response line and assert it contains text
|
||||
IpcExpect(String),
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
@@ -300,6 +305,14 @@ fn parse_action_expr(input: ParseStream) -> syn::Result<ActionExpr> {
|
||||
let items = parse_string_list(input)?;
|
||||
Ok(ActionExpr::AddItems(items))
|
||||
}
|
||||
"ipc-send" => {
|
||||
let val: LitStr = input.parse()?;
|
||||
Ok(ActionExpr::IpcSend(val.value()))
|
||||
}
|
||||
"ipc-expect" => {
|
||||
let val: LitStr = input.parse()?;
|
||||
Ok(ActionExpr::IpcExpect(val.value()))
|
||||
}
|
||||
_ => Ok(ActionExpr::Simple(name)),
|
||||
}
|
||||
}
|
||||
@@ -317,9 +330,10 @@ fn parse_kind(input: ParseStream) -> syn::Result<TestKind> {
|
||||
"filter" => Ok(TestKind::Filter),
|
||||
"nav" => Ok(TestKind::Nav),
|
||||
"menu" => Ok(TestKind::Menu),
|
||||
"ipc" => Ok(TestKind::Ipc),
|
||||
other => Err(syn::Error::new(
|
||||
ident.span(),
|
||||
format!("unknown test kind '{other}', expected headless, filter, nav, or menu"),
|
||||
format!("unknown test kind '{other}', expected headless, filter, nav, menu, or ipc"),
|
||||
)),
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user