From 24bdab8c2af5a3d60846d08859a86d76830747e0 Mon Sep 17 00:00:00 2001 From: LGUG2Z Date: Fri, 6 Nov 2026 15:51:41 -0800 Subject: [PATCH] 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. --- crates/komorebic-core/tests/docs_cli.rs | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/crates/komorebic-core/tests/docs_cli.rs b/crates/komorebic-core/tests/docs_cli.rs index 1a6b0e16..fb6fb84b 100644 --- a/crates/komorebic-core/tests/docs_cli.rs +++ b/crates/komorebic-core/tests/docs_cli.rs @@ -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::(&META), &DocFormat::PLAIN); let mut stale = Vec::new(); for (name, page) in &rendered {