F3.2: assert Diag for the zero-arg and too-many-flags raise sites

Example 0717 now asserts the (token, index) Diag for ALL SIX raise sites
in cli.sx, closing the two the reviewer found still unasserted:

  - zero-arg UnknownCommand: parse([], ...) -> index -1, token ""
    (the args.len == 0 sub-branch of cli.sx:237, distinct from the
    one-arg too-few form already covered at index 0 / token args[0]).
  - TooManyFlags (cli.sx:256): a command declaring 17 flag specs (> the
    inline 16 cap) is rejected, not truncated -> index -1, token command.

The three index==-1 cases (zero-arg, too-many, missing-req) seed their
Diag with a sentinel before parse, so each assertion proves parse WROTE
the -1/"" rather than merely matching the `.{}` default. Verified
non-vacuous: flipping any expected value makes that line FAIL.

Test-only: cli.sx logic and src/ are untouched.
This commit is contained in:
agra
2026-06-04 07:54:20 +03:00
parent d1e5f10039
commit 9784ff8705
2 changed files with 70 additions and 15 deletions

View File

@@ -19,6 +19,7 @@ sep-no-bool: ok
bare-rest-len: ok
bare-rest-0: ok
dash-value: ok
err-zero-args: ok
err-unknown-cmd: ok
err-unknown-group: ok
err-too-few: ok
@@ -26,6 +27,7 @@ err-unknown-flag: ok
err-missing-value: ok
err-value-eats-flag: ok
err-missing-req: ok
err-too-many-flags: ok
diag-flag-tag: ok
diag-flag-token: ok
diag-cmd-tag: ok
@@ -34,6 +36,8 @@ diag-group-tag: ok
diag-group-token: ok
diag-too-few-tag: ok
diag-too-few-token: ok
diag-zero-args-tag: ok
diag-zero-args-token: ok
diag-missing-value-tag: ok
diag-missing-value-token: ok
diag-value-eats-tag: ok
@@ -41,4 +45,6 @@ diag-value-eats-token: ok
diag-req-tag: ok
diag-req-token: ok
diag-req-index: ok
diag-too-many-tag: ok
diag-too-many-token: ok
=== DONE ===