fix(test): build the macOS pages test on a macOS host only

`komorebic-core::docs_cli every_macos_page_is_as_checked_in` failed in the linux-test run (1 of 1633 tests):
six pages of docs/macos/cli looked stale. ApplicationIdentifier::Class has three wordings through cfg_attr
(Class on Windows, "Accessibility subrole or role, such as AXStandardWindow" on macOS, "Role or subrole"
elsewhere) and the command line renders the wording of the host it is built for, so a Linux host cannot
render the pages as they are checked in, and the pages are right. The test skipped on Windows only, on the
belief that the linux run covered it, which stopped being true when macOS got its own wording.

The test file is built for a macOS host only now (#![cfg(target_os = "macos")]), so on another host there is
no test, where an early return would have been one that passes without having checked. Its remaining
guard, a missing docs/macos/cli, is an assertion: it was for the source tree of the Windows workspace, which
does not build the test any more.
This commit is contained in:
LGUG2Z committed 2026-11-06 16:07:50 -08:00
1 parent e0ffc1992d
commit 24bdab8c2a
1 file changed
+13 -10
+13 -10
View File
@@ -1,4 +1,13 @@
//! The pages of `docs/cli` that are checked in are what the command line renders today.
//!
//! The identifiers are worded per platform (`ApplicationIdentifier::Class` is "Class" on Windows,
//! "Accessibility subrole or role, such as AXStandardWindow" on macOS and "Role or subrole" on Linux),
//! and the command line renders the wording of the host it is built for: only a macOS host renders the
//! pages of `docs/macos/cli` as they are checked in. So the test is built on macOS only, and the macOS
//! job of ci runs it (`_macos.yaml`); on another host there is nothing to run, and nothing that passes
//! without having checked.
#![cfg(target_os = "macos")]
use komorebic_core::cli::Meta;
use komorebic_core::cli::command;
@@ -28,16 +37,10 @@ fn macos_page(name: &str, page: &str) -> String {
#[test]
fn every_macos_page_is_as_checked_in() {
let dir = Path::new(env!("CARGO_MANIFEST_DIR")).join("../../docs/macos/cli");
if !dir.is_dir() {
// a source tree without the macOS tree (the nix build of the Windows workspace)
return;
}
if cfg!(windows) {
// the identifiers are worded per platform, and a Windows host renders its own wording;
// the pages are the same on the hosts that have the macOS one, which the linux run covers
return;
}
assert!(
dir.is_dir(),
"the pages of the macOS command line are not in {dir:?}"
);
let rendered = pages(command::<MacosCommands>(&META), &DocFormat::PLAIN);
let mut stale = Vec::new();
for (name, page) in &rendered {