use crate::brain::agent::service::phantom::{
has_phantom_tool_intent_no_tools, matches_work_announcement,
};
#[test]
fn english_running_checks_now_is_phantom() {
assert!(has_phantom_tool_intent_no_tools("Running checks now."));
assert!(has_phantom_tool_intent_no_tools("Checking the logs now…"));
assert!(has_phantom_tool_intent_no_tools("Rebuilding now."));
assert!(has_phantom_tool_intent_no_tools(
"Running the test suite..."
));
assert!(has_phantom_tool_intent_no_tools("Verifying the changes:"));
}
#[test]
fn announcement_at_start_of_multi_sentence_turn_is_phantom() {
assert!(has_phantom_tool_intent_no_tools(
"Running fmt, clippy, tests now. Then fetching fresh commits.\n\nClippy clean. Tests next."
));
assert!(has_phantom_tool_intent_no_tools(
"Running the tests now, then I'll report back."
));
}
#[test]
fn now_as_an_adverb_is_not_an_announcement() {
assert!(!matches_work_announcement(
"Running the suite now takes about ten minutes on CI."
));
assert!(!matches_work_announcement(
"Building it now would break the release, so let's wait."
));
}
#[test]
fn work_announcement_detected_in_every_language() {
assert!(
has_phantom_tool_intent_no_tools("Ejecutando las pruebas ahora."),
"es"
);
assert!(
has_phantom_tool_intent_no_tools("Executando os testes agora."),
"pt"
);
assert!(
has_phantom_tool_intent_no_tools("Je vérifie les fichiers maintenant."),
"fr"
);
assert!(
has_phantom_tool_intent_no_tools("Vérification en cours…"),
"fr-noun"
);
assert!(
has_phantom_tool_intent_no_tools("Сейчас запускаю проверки."),
"ru-front"
);
assert!(
has_phantom_tool_intent_no_tools("Запускаю проверки сейчас."),
"ru-back"
);
}
#[test]
fn work_announcement_rejects_plain_gerund_sentences() {
assert!(!matches_work_announcement(
"Reading the file is straightforward."
));
assert!(!matches_work_announcement(
"Running the suite revealed three failures."
));
assert!(!matches_work_announcement(
"Building blocks are fundamental here."
));
assert!(!matches_work_announcement(
"Checking is handled by the CI pipeline, not locally."
));
}
#[test]
fn work_announcement_matches_only_with_imminence_marker() {
assert!(matches_work_announcement("Running the tests now."));
assert!(!matches_work_announcement("Running the tests helped."));
}
#[test]
fn now_followed_by_colon_is_phantom() {
assert!(has_phantom_tool_intent_no_tools(
"Checking cron runs now: I'll verify the schedule."
));
assert!(has_phantom_tool_intent_no_tools(
"Running checks now: let me look at the recent results."
));
assert!(matches_work_announcement("Verifying the deployment now:"));
assert!(matches_work_announcement(
"Building the project now: clippy is clean."
));
}