test: Added missing tests.

This commit is contained in:
2026-06-14 22:08:04 -04:00
parent 46c2baf726
commit 83acf00d85
22 changed files with 427 additions and 24 deletions

View File

@@ -2,8 +2,9 @@
## Current State
- 60 tests, all passing
- 63 tests, all passing (added 3 `render_table` tests)
- Strong coverage: crypto (100%), ssh (80%), scan, features
- `render_table` now takes `io.Writer` (Tier 1 item 1 done)
- Misleading test files: `cmd_check_test`, `cmd_list_test`, `cmd_nushell_completion_test` don't test their namesake procs
- Biggest gap: `db.odin` (15/21 procs untested), all `cmd_*` handlers untested, `parse_args` untested
@@ -14,9 +15,12 @@
- Test cases: normal data (verify box-drawing chars, column alignment), empty rows, wide unicode, single column
- Assert against `strings.Builder` output
### 2. `parse_args` (cli.odin)
- Test cases: bare command, `--flag value`, `-f value`, positional args, `--help`/`-h`, unknown command, no args (prints usage), flag without value (error)
- High value — this is the entry point for all command dispatch
### 2. `parse_args` (cli.odin) — BLOCKED: needs refactor
- Reads `os.args` directly and calls `print_usage()`/`print_command_help()` as side effects
- Cannot test without either accepting `[]string` param or extracting output
- Minimal refactor: `parse_args(args: []string)` — caller passes `os.args`, tests pass synthetic slices
- Return values (`ok`, `cmd.name`, `cmd.flags`, `cmd.bool_set`) are the interesting part to assert
- Test cases: bare command, `--flag value`, `-f value`, positional args, `--help`/`-h`, unknown command, no args, mixed flags + positionals
### 3. `is_encrypted_key` (ssh.odin)
- Test cases: encrypted key (returns true), unencrypted key (returns false), RSA key, malformed key