---
id: TASK-29
title: Add unit tests for menuconfig CLI parsing and command behavior
status: Done
assignee:
  - codex
created_date: '2026-03-04 14:12'
updated_date: '2026-03-04 14:34'
labels: []
dependencies: []
references:
  - src/core/cli.rs
  - src/core/cmd.rs
---

## Description

<!-- SECTION:DESCRIPTION:BEGIN -->
Add unit tests that cover the new menuconfig command wiring and behavior so regressions are caught without invoking external tools.
<!-- SECTION:DESCRIPTION:END -->

## Acceptance Criteria
<!-- AC:BEGIN -->
- [x] #1 CLI parsing covers `menuconfig` with `--list`/`--image` and the `m` alias.
- [x] #2 `cmd_menuconfig` unit tests cover non-sysbuild list error and sysbuild list success using temporary build dirs.
- [x] #3 `cmd_menuconfig` unit tests cover sysbuild image selection (explicit image or default selection) without executing external commands (dry-run).
- [x] #4 All new tests pass under `just check`.
<!-- AC:END -->

## Implementation Plan

<!-- SECTION:PLAN:BEGIN -->
1. Add CLI parsing tests for `menuconfig` with `--list`/`--image` and the `m` alias in `src/core/cli.rs`.
2. Add `cmd_menuconfig` unit tests in `src/core/cmd.rs` for non-sysbuild list error and sysbuild list success using temp build dirs.
3. Add `cmd_menuconfig` unit tests for sysbuild image selection (explicit image and default selection) using dry-run to avoid external execution.
4. Run `just check` and update acceptance criteria in the task.
<!-- SECTION:PLAN:END -->

## Implementation Notes

<!-- SECTION:NOTES:BEGIN -->
Added menuconfig CLI parsing tests and cmd_menuconfig unit tests for list and sysbuild image selection. Ran `just check`.
<!-- SECTION:NOTES:END -->

## Final Summary

<!-- SECTION:FINAL_SUMMARY:BEGIN -->
Summary:
- Added CLI parsing coverage for `menuconfig` including sysbuild args and `m` alias.
- Added command handler tests for menuconfig list/error paths and sysbuild image selection.

Tests:
- `just check`
<!-- SECTION:FINAL_SUMMARY:END -->
