Summary
exec() (simplemock.go:160-341) contains several error branches that are only reachable by running the full binary and are not covered by any focused test. The package-loading section is the hardest to reach via E2E because it requires simulating failures in the Go toolchain or type-checker.
Uncovered error paths
| Line |
Condition |
| 203–206 |
packages.Load() returns a non-nil error |
| 207–210 |
packages.Load() returns an empty package list |
| 212–219 |
Loaded package has parse errors or type errors (pkg.Errors) |
| 221–224 |
filepath.Abs() fails and the fallback path is used |
| 258–261 |
Type-checker lookup succeeds but the object is not a *types.TypeName |
Proposed approach
Refactor exec() to accept a loadFunc parameter (or similar interface) so that packages.Load can be swapped for a stub in tests. This would allow each error branch to be triggered without needing a full Go toolchain or real source files.
Alternatively, add integration-style tests that set up minimal on-disk Go packages in t.TempDir() and invoke exec() directly.
Summary
exec()(simplemock.go:160-341) contains several error branches that are only reachable by running the full binary and are not covered by any focused test. The package-loading section is the hardest to reach via E2E because it requires simulating failures in the Go toolchain or type-checker.Uncovered error paths
packages.Load()returns a non-nil errorpackages.Load()returns an empty package listpkg.Errors)filepath.Abs()fails and the fallback path is used*types.TypeNameProposed approach
Refactor
exec()to accept aloadFuncparameter (or similar interface) so thatpackages.Loadcan be swapped for a stub in tests. This would allow each error branch to be triggered without needing a full Go toolchain or real source files.Alternatively, add integration-style tests that set up minimal on-disk Go packages in
t.TempDir()and invokeexec()directly.