uttrflow / uttrflow/uttrflow-swift
Test ProgramVerbs refusing indented prose, and reading tab-separated and digit-bearing command names
- Dominant language
- Swift
- Stars
- 4
- Forks
- 17
- Avg merge
- 3h 32m
- Merged PRs (30d)
- 277
Description
## What happens
`Sources/UttrflowPredict/ProgramVerbs.swift:55-78` reads a program's `--help` output to learn its subcommands. These have never run:
- line 71: the `[]` for an indented name followed by a single-space sentence (prose, not a command list);
- line 69: a name separated from its description by a tab;
- line 62: a line that is empty once its indentation is dropped;
- line 77: names containing digits, `-` or `_` after the first letter (`s3`, `dry-run`, `list_all`).
Measured on origin/main `26d7bc1` with `swift test --enable-code-coverage` (5,384 tests, all passing) and `xcrun llvm-cov export` over the test binary. The regions named below have an execution count of 0: no test runs them, so a change that breaks them passes `make verify`.
## Why it matters
A help page's prose lines must not become suggested subcommands. Without the refusal, " Use this to..." teaches the suggestions that `use` is a verb of that program, and it gets offered after the program's name.
## How to reproduce
Run `swift test --enable-code-coverage`, then `xcrun llvm-cov show -instr-profile .build/debug/codecov/default.profdata .build/debug/UttrflowPackageTests.xctest/Contents/MacOS/UttrflowPackageTests Sources/UttrflowPredict/ProgramVerbs.swift` and look for the `0` counts on the lines named above.
## Acceptance criteria
- Help text with `" see the manual for more"` yields no `see`.
- `" build\tCompile the project"` yields `build`; `" s3 Manage buckets"` and `" dry-run Show what would happen"` yield `s3` and `dry-run`.
- A help text with blank indented lines between entries yields the same names as without them.
- Each new test fails when the branch it covers is broken. Check this by hand before opening the PR: temporarily change the branch (flip the condition or return the other value), see the test fail, then restore it.
## Where to start
- `Tests/UttrflowPredictTests/ProgramVerbsTests.swift`, suite "Reading the verbs a program takes".
Read `CONTRIBUTING.md` first. Iterate with `swift test --filter `, then run `make verify` before pushing. Only tests change; no product code needs to.
**Size:** S, under an hour.
Contributor guide
Research direction
Read CONTRIBUTING.md, then open Tests/UttrflowPredictTests/ProgramVerbsTests.swift and the “Reading the verbs a program takes” suite. Run the focused suite with swift test --filter, adding coverage for prose, tab-separated and digit- or punctuation-bearing names, and blank indented lines. Done means the stated acceptance cases pass and make verify succeeds.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- swift
- Domain
- testing
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- Under an hour
- Activity status
- Active
- Clarity
- Clearly specified
- Newbie friendliness
- 92/100