use pretty_assertions::assert_eq;
use super::parse_probe_response;
// Covers: the probe keeps the terminal's XTVERSION text, which names it for
// `icons = "auto"`, only from a reply before the device attributes sentinel.
// Owner: startup terminal probe.
#[test]
fn keeps_the_xtversion_reply_before_da1() {
const DA1: &str = "\x1b[?62;22c";
let cases = [
(
"answered",
format!("\x1bP>|kitty(0.36.0)\x1b\\{DA1}"),
Some("kitty(0.36.0)"),
),
("not answered", DA1.to_owned(), None),
(
"after DA1",
format!("{DA1}\x1bP>|ghostty 1.2.3\x1b\\"),
None,
),
];
for (name, response, expected) in cases {
assert_eq!(
parse_probe_response(&response).xtversion.as_deref(),
expected,
"{name}"
);
}
}