Skip to content

Report deletes as directory relative paths - #1863

Merged
SimonCropp merged 1 commit into
mainfrom
fix-delete-section-paths
Aug 17, 2026
Merged

Report deletes as directory relative paths#1863
SimonCropp merged 1 commit into
mainfrom
fix-delete-section-paths

Conversation

@SimonCropp

Copy link
Copy Markdown
Member

The Delete: section emitted Path.GetFileName(file), while New:, NotEqual: and Equal: all emit a path relative to the reported directory, and Verify.ExceptionParsing rebuilds each delete entry with Path.Combine(directory, name).

For flat layouts the two agree, so this only shows up where snapshots live in a subdirectory — UseUniqueDirectory() and VerifyDirectory. A stale {Directory}\Type.Method\old.verified.txt was reported as just old.verified.txt and parsed back as {Directory}\old.verified.txt, which does not exist. Same-named files in different subdirectories also collapsed onto one entry.

The section now uses IoHelpers.GetRelativePath, the same call the other sections use, so the round trip holds.

Also documents the invariant in exception-message-format.md: the file listing paths are relative to the reported directory and keep any subdirectory. The doc previously only said the inline paths are absolute, leaving the file sections implicit.

Two tests, one per side of the round trip: VerifyExceptionMessageBuilderTests.DeleteInSubDirectory for what is emitted, and ExceptionParsingTests.DeleteInSubDirectory for what comes back. On main both produce old.verified.txt / {ProjectDirectory}old.verified.txt.

Verify.ExceptionParsing.Tests (84 across net11.0 and net48), Verify.Tests (1299) and StaticSettingsTests pass. No existing snapshot changed — the other Delete: snapshots all use flat paths.

The Delete: section emitted Path.GetFileName while every other section emits a
path relative to the reported directory, and the parser rebuilds each entry with
Path.Combine(directory, name). UseUniqueDirectory and VerifyDirectory keep their
snapshots in a subdirectory, so a stale {Directory}\Type.Method\old.verified.txt
was reported as old.verified.txt and parsed back as the nonexistent
{Directory}\old.verified.txt. Same named files in different subdirectories
collapsed onto one entry.

Also documents that the file listing paths are directory relative.
@SimonCropp SimonCropp added this to the 32.0.0 milestone Aug 17, 2026
@SimonCropp
SimonCropp merged commit c11871d into main Aug 17, 2026
7 checks passed
@SimonCropp
SimonCropp deleted the fix-delete-section-paths branch August 17, 2026 12:27
This was referenced Aug 26, 2026
This was referenced Aug 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant