mirror of
https://github.com/unclebob/mutator.git
synced 2026-11-12 04:33:49 +00:00
Why: every Go run printed "No coverage data for <file>; its sites are uncovered". `go test -coverprofile` keys files by import path (`github.com/acme/tool/cmd/tool/main.go`); mutator looked them up by absolute disk path (`/.../tool/cmd/tool/main.go`). Neither path ends with the other, so no Go file ever matched and only --no-coverage ran sites. What: `_go_lines` asks crapper's `go_import_name` for the profile's name of the file (nearest go.mod module line plus path inside the module) and `_lookup` tries that name as an exact key, then the existing suffix match. Other languages pass no name and are unchanged. Needs crapper c757ec7 or later. Proof: two new specs (module at the root, module in a subdirectory with a different name) failed with None first, now pass; 78 pass. crapper: _go_lines 6.0, covered_lines 5.0, _lookup 4.0. dryer: no candidates. mutator on the changed lines: one equivalent survivor (insert(0) vs insert(1)) removed by appending the name; no survivors left.