What
Write host-side unit tests for the CLI command parser in CommandManager.
Why
The CLI is accessible via USB Serial (no auth) and Bluetooth (PIN auth). A parser bug on the unauthenticated USB path could brick the device, corrupt config, or leak data. Currently untested.
How
- Create
test/test_command_parser/test_main.cpp following the pattern of test/test_validators/test_main.cpp
- Add a
test_filter = test_command_parser line or include in native env
- Test at minimum:
- Valid commands:
help, show system, conf user add ..., clear log confirm
- Invalid commands: empty string, garbage, buffer overflow at
CLI_LINE_MAX=256
- Edge cases: trailing whitespace, extra spaces between args, Unicode bytes
- Partial commands:
conf without subcommand, show without target
- Auth boundary: commands available before vs after BT PIN auth
Acceptance
References
src/CommandManager.h and src/CommandManager.cpp
src/SystemDefs_Cli.h — CliDemand struct
test/test_validators/test_main.cpp — pattern to follow
What
Write host-side unit tests for the CLI command parser in
CommandManager.Why
The CLI is accessible via USB Serial (no auth) and Bluetooth (PIN auth). A parser bug on the unauthenticated USB path could brick the device, corrupt config, or leak data. Currently untested.
How
test/test_command_parser/test_main.cppfollowing the pattern oftest/test_validators/test_main.cpptest_filter = test_command_parserline or include in native envhelp,show system,conf user add ...,clear log confirmCLI_LINE_MAX=256confwithout subcommand,showwithout targetAcceptance
pio test -e nativepassesReferences
src/CommandManager.handsrc/CommandManager.cppsrc/SystemDefs_Cli.h—CliDemandstructtest/test_validators/test_main.cpp— pattern to follow