Skip to content

feat: add statement removal mutation operator - #87

Merged
sivchari merged 1 commit into
mainfrom
worktree-feat+statement-removal-6
Jun 15, 2026
Merged

sivchari merged 1 commit into
mainfrom
worktree-feat+statement-removal-6

Conversation

@sivchari

Copy link
Copy Markdown
Owner

Summary

  • Add StatementRemovalMutator that removes statements carrying a side effect by replacing them with an empty statement
  • Covers increment/decrement (i++, i--), defer, go, and channel send (ch <- v)
  • Uses the CursorApplier interface for node replacement

Disambiguation from related issues

One of three statement-removal operators, partitioned by node type to avoid duplicate mutants:

AssignStmt and ExprStmt are explicitly excluded here so the three operators never target the same node.

Changes

  • internal/mutation/statementremoval.go — new mutator
  • internal/mutation/statementremoval_test.go — unit tests (incl. ApplyWithCursor)
  • internal/mutation/registry.go — regenerated (8 mutators)
  • internal/mutation/engine_test.go — updated mutator count/list
  • internal/execution/overlay_test.go + testdata — end-to-end golden test
  • README.md — documented the new mutation type

Test plan

  • go build ./..., go vet ./..., go test ./...
  • TestMutateAndApplyIntegration covers removing *counter++
  • make lint (pinned golangci-lint) reports 0 issues

Closes #6

Add StatementRemovalMutator that removes increment/decrement, defer,
go, and channel send statements by replacing them with an empty
statement, testing whether their side effects are covered by tests.

Assignment and expression statements are intentionally excluded; they
are handled by the dedicated assignment_removal and expression_removal
mutators to avoid generating duplicate mutants.

Closes #6
@sivchari
sivchari force-pushed the worktree-feat+statement-removal-6 branch from 56c8dd1 to acd24a7 Compare June 15, 2026 05:22
@github-actions

Copy link
Copy Markdown
Contributor

🧬 Mutation Testing Results

Quality Gate: PASSED

Overall Mutation Score: 63.2%
Total Mutants: 38
Killed: 24

Files with Mutations

File Score Mutants Killed
...er/work/gomu/gomu/internal/mutation/registry.go 0.0% 1 0
...gomu/gomu/internal/mutation/statementremoval.go 64.9% 37 24

Generated by gomu mutation testing

@sivchari
sivchari merged commit b62720a into main Jun 15, 2026
5 checks passed
@sivchari
sivchari deleted the worktree-feat+statement-removal-6 branch June 15, 2026 05:24
@github-actions github-actions Bot mentioned this pull request Jun 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Statement removal mutations

1 participant