2.4 KiB
PR#90: A File That Only Moved Is Not Mutated by a Branch
Version: patch
WARNING: This document describes only the change applied in this PR. It may already be outdated once the next PR is merged. Historic PR documentation is not maintained along with new PRs; treat it as a snapshot.
Related Links
- werkregie PR#86, after which werkregie moves from
de.hoennigtode.javagil.
Problem
pitestPartial mutates each class of each Kotlin file that a branch changes, and fails a method above a Mutation-CRAP of 15.
The move of werkregie to de.javagil.werkregie changes the package line of each file.
Each method of main above 15 would then fail the branch of the move, though no line of its code changed.
The rule of the shared workflow allows a move PR nothing but the move, so this change goes first.
Non-Goals
- No move of packages; that follows in a PR of its own.
- No change of the nightly
pitestFulland its ratchet.
Specification
Feature: a file that only moved counts as unchanged for the mutation tests of a branch
Scenario#90.01: a file that only moved to another package is not mutated
… so that a move of a package does not measure each of its methods against the limit of a branch.
- Given a branch that moves a source file to another package and changes nothing else in its code
- When the build of the branch runs its mutation tests
- Then they do not mutate that file
Verified by
- build.gradle.kts, task
checkMovedOnly, part ofcheck
Scenario#90.02: a file that moved and changed its code is mutated
… so that a move does not hide a change of code.
- Given a branch that moves a source file to another package and changes a line of its code
- When the build of the branch runs its mutation tests
- Then they mutate that file
Verified by
- build.gradle.kts, task
checkMovedOnly, part ofcheck
Solution
changedClassesasksgit diff --name-status -Mfor the renames and compares each moved file with its old version.movedOnlyignorespackageandimportlines, blank lines and the indentation of a line; any other difference counts as a change.checkMovedOnlychecksmovedOnlywith examples, ascheckRepositoryWebUrldoes.
Open Questions
None.