Test that the shipped autostart parses to what it documents

The template is mostly prose, and `#` starts a comment wherever a word would
start -- so a comment marker landing in the wrong column drops a command
silently rather than failing. Parsing the real file in a test means editing
the explanatory text around a command cannot quietly disable it.

Tests only; no behaviour change, so the installed session binary is unaffected.
This commit is contained in:
2026-08-10 09:49:43 +07:00
parent 1c3e3c3e53
commit 04b61b49df
+15
View File
@@ -281,4 +281,19 @@ mod tests {
fn missing_extras_file_is_not_an_error() {
assert!(read_extras(std::path::Path::new("/nonexistent/hyprcosmic/autostart")).is_empty());
}
/// The template we ship is mostly prose, and `#` starts a comment wherever
/// a word would start — so a comment marker in the wrong column drops a
/// command silently instead of failing. Parse the real file and assert
/// what it yields, so editing the prose cannot quietly disable the bar.
#[test]
fn the_shipped_autostart_parses_to_the_commands_it_documents() {
let text = include_str!(concat!(env!("CARGO_MANIFEST_DIR"), "/../config/autostart"));
let got = parse_extras(text);
assert_eq!(got.len(), 3, "{got:?}");
// First, so its startup compile lands before the compositor settles.
assert_eq!(got[0], vec!["cosmic-conf", "watch"]);
assert_eq!(got[1][0], "waybar");
assert_eq!(got[2], vec!["awww-daemon"]);
}
}