From 04b61b49df6ee6b67b5629a8e2bec6ae8e6f9962 Mon Sep 17 00:00:00 2001 From: dingo Date: Mon, 10 Aug 2026 09:49:43 +0700 Subject: [PATCH] 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. --- src/profile.rs | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/profile.rs b/src/profile.rs index bee6631..71e9d2a 100644 --- a/src/profile.rs +++ b/src/profile.rs @@ -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"]); + } }