Skip to content

feat: add expression removal mutation operator - #86

Merged
sivchari merged 1 commit into
mainfrom
worktree-feat+expression-removal-20
Jun 14, 2026
Merged

sivchari merged 1 commit into
mainfrom
worktree-feat+expression-removal-20

Conversation

@sivchari

Copy link
Copy Markdown
Owner

Summary

  • Add ExpressionRemovalMutator that removes expression statements (replaces them with an empty statement)
  • Targets *ast.ExprStmt (function calls evaluated for side effects, channel receives used for sync, etc.)
  • 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:

Note

TestGenerateMutants_NoMutations previously relied on fmt.Println("hello") (an expression statement); the sample is now an empty function body.

Changes

  • internal/mutation/expressionremoval.go — new mutator
  • internal/mutation/expressionremoval_test.go — unit tests (incl. ApplyWithCursor)
  • internal/mutation/registry.go — regenerated (8 mutators)
  • internal/mutation/engine_test.go — updated mutator count/list and no-mutations sample
  • 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 a ping() call
  • make lint (pinned golangci-lint) reports 0 issues

Closes #20

Add ExpressionRemovalMutator that removes expression statements (e.g.
function calls evaluated for their side effects) by replacing them
with an empty statement, testing whether those side effects are
properly covered by tests.

The no-mutations engine test sample was updated to an empty function
body since an expression statement is now a valid mutation target.

Closes #20
@sivchari
sivchari force-pushed the worktree-feat+expression-removal-20 branch from adf626f to 3008118 Compare June 14, 2026 13:45
@github-actions

Copy link
Copy Markdown
Contributor

🧬 Mutation Testing Results

Quality Gate: PASSED

Overall Mutation Score: 58.1%
Total Mutants: 31
Killed: 18

Files with Mutations

File Score Mutants Killed
...omu/gomu/internal/mutation/expressionremoval.go 60.0% 30 18
...er/work/gomu/gomu/internal/mutation/registry.go 0.0% 1 0

Generated by gomu mutation testing

@sivchari
sivchari merged commit b246253 into main Jun 14, 2026
5 checks passed
@sivchari
sivchari deleted the worktree-feat+expression-removal-20 branch June 14, 2026 13:47
@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.

Expression removal mutations

1 participant