const TUI: [&str; 3] = ["mod.rs", "app.rs", "view.rs"];
const FORBIDDEN: [&str; 13] = [
"EnableMouseCapture",
"DisableMouseCapture",
"PushMouseReport",
"PopMouseReport",
"MouseEvent",
"MouseButton",
"MouseEventKind",
"clipboard::",
"clipboard_path",
"osc52",
"wl-copy",
"xclip",
"xsel",
];
#[test]
fn the_interface_never_asks_for_the_pointer_or_touches_a_clipboard() {
let dir = std::path::Path::new(env!("CARGO_MANIFEST_DIR")).join("src/tui");
let mut read = 0;
for name in TUI {
let path = dir.join(name);
let text = std::fs::read_to_string(&path)
.unwrap_or_else(|why| panic!("could not read {}: {why}", path.display()));
read += 1;
for forbidden in FORBIDDEN {
assert!(
!text.contains(forbidden),
"{} still mentions {forbidden:?}: the terminal owns the selection, its own menu \
and its own clipboard, and asking for any of them takes them back",
path.display()
);
}
}
assert_eq!(read, TUI.len(), "every file was read");
}