Repository navigation
macOS menu test: use the whole native menu, so clippy passes on a Mac - #2970
Conversation
e6df6f4 removed the #[allow(unused_imports, dead_code)] on the native_menu module that tests/mac_menu_appkit.rs builds in. That test only compiles on macOS, so `cargo xtask ci` has failed at clippy on every Mac since, while the Linux gate stayed green: - the test called only `install`, leaving `poll`, `sync_windows`, `select_theme`, `WINDOW_ITEM` and most `NativeMenu` fields unused; - the harness = false build has cfg(test) but drops #[test] functions, so the unit tests' `use super::*` was an unused import. The test now also polls the menu with a one-workbook session and checks that the Window menu lists that workbook (storytold#716), which uses the rest of the module. The unit tests name `super::` items instead of a glob import. Verified on macOS 27 (arm64): `cargo xtask ci` passes all 10 steps (with CRAFT_FONTS_DIR at the gate's craft-fonts commit), and the new check fails when the poll is removed (Window menu's last item "" vs "Book1").
|
No actionable comments were generated in the recent review.
|
| Layer / File(s) | Summary |
|---|---|
Native-menu unit-test references apps/gridcraft/src/native_menu.rs |
Tests qualify references to tree, SheetApp, and select_theme through super. Test assertions and expected behavior are unchanged. |
AppKit Window-menu checks apps/gridcraft/tests/mac_menu_appkit.rs |
The test retains a mutable NativeMenu, checks the Window-menu title, creates a workbook, polls the menu, and checks that the final item matches the open window’s label. |
Priority:
Estimated code review effort: 2 (Simple) | ~10 minutes
Change: Bug fix
Suggested reviewers: dylanmtaylor
Merge Risk: 
Minimal · up to 1d38a
-
No actionable merge-blocking risk remains in this test-only change.
Pre-merge checks: 
4 · 
1
-
Failed checks: 1 warning Passed checks: 4 passedFull details: Docstring Coverage
-
Explanation
Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 1 functions across 2 files.
Resolution
Write docstrings for the functions missing them to satisfy the coverage threshold.
-
Finishing Touches
-
🧪 Generate unit tests (beta)
-
- Create a new PR
-
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Comment @coderabbitai help to get the list of available commands.
|
Landed in main (75f7056). Thank you for the contribution, @Aimarmndz! If you haven't already, come join us on Discord: https://discord.gg/artcraft |
Problem
e6df6f4 (strict Clippy) removed the
#[allow(unused_imports, dead_code)]on thenative_menumodule thatapps/gridcraft/tests/mac_menu_appkit.rsbuilds in. That test only compiles on macOS, so since thencargo xtask cifails at clippy on every Mac, while the Linux gate stays green:install, sopolland everything it reaches were dead in that build.harness = falsetest is built withcfg(test)but without the#[test]functions, so the unit tests'use super::*was unused.Fix (no
allow)mac_menu_appkitnow polls the menu with a one-workbook session and checks that the Window menu lists that workbook (MacOS - [Move,Resize,Fill,Arange windows/screen] #716). That uses the rest of the module and tests one more thing AppKit-side.native_menuunit tests namesuper::items instead of a glob import.Verification (macOS 27, arm64)
cargo xtask ci: all 10 steps pass, withCRAFT_FONTS_DIRat the gate's craft-fonts commit (b076417). Onmain(68a4b1a) it fails at clippy as above.pollcall is removed: the Window menu's last item is""instead of"Book1".cfg(target_os = "macos")in that test); I couldn't run the Linux gate here, GitHub Actions does.Summary by CodeRabbit