Repository navigation
Commit 4956373
test(diff): pin both flush sites with a two-file fixture; move instead of clone
Amendment from self-review of the original commit:
- The regression test used a single-file diff, but condense_unified_diff
flushes a file's changes at two separate sites — once per `+++` for the
preceding file, once after the loop for the last one. A single-file fixture
only ever reaches the second: mutation testing showed the in-loop site could
be reverted to the indenting form with the whole suite still green. The
fixture now carries two files and fails against that mutant.
- The anti-indent assertion was a blanket "no line starts with a space",
which the ` ... +N more` trailer makes false for any diff with more than
ten changes. Scoped to change lines.
- The flush loops now move the lines (`result.append(&mut changes)`) instead
of cloning each one; the mid-loop `changes.clear()` stays for the
branch-not-taken path. The `Vec<String>` annotation is dropped — inference
comes from `changes.push(line.to_string())`, so it was never needed (the
original commit message's claim about the removed `format!` was wrong;
`format!` accepts any Display and contributes no type information).
Gate: cargo fmt --all / clippy --all-targets / test --all all exit 0.1 parent ca85483 commit 4956373
1 file changed
Lines changed: 26 additions & 15 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
164 | 164 | | |
165 | 165 | | |
166 | 166 | | |
167 | | - | |
| 167 | + | |
168 | 168 | | |
169 | 169 | | |
170 | 170 | | |
| |||
173 | 173 | | |
174 | 174 | | |
175 | 175 | | |
176 | | - | |
177 | | - | |
178 | | - | |
179 | | - | |
| 176 | + | |
| 177 | + | |
180 | 178 | | |
181 | 179 | | |
182 | 180 | | |
| |||
198 | 196 | | |
199 | 197 | | |
200 | 198 | | |
201 | | - | |
202 | | - | |
203 | | - | |
204 | | - | |
| 199 | + | |
| 200 | + | |
205 | 201 | | |
206 | 202 | | |
207 | 203 | | |
| |||
398 | 394 | | |
399 | 395 | | |
400 | 396 | | |
401 | | - | |
402 | | - | |
403 | | - | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
| 403 | + | |
| 404 | + | |
404 | 405 | | |
405 | | - | |
406 | | - | |
| 406 | + | |
| 407 | + | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
| 412 | + | |
| 413 | + | |
| 414 | + | |
| 415 | + | |
407 | 416 | | |
408 | | - | |
| 417 | + | |
| 418 | + | |
| 419 | + | |
409 | 420 | | |
410 | 421 | | |
411 | 422 | | |
| |||
0 commit comments