Skip to content

Add Inline snpashot support - #1832

Merged
SimonCropp merged 29 commits into
mainfrom
inline
Aug 10, 2026
Merged

Add Inline snpashot support#1832
SimonCropp merged 29 commits into
mainfrom
inline

Conversation

@SimonCropp

@SimonCropp SimonCropp commented Aug 10, 2026

Copy link
Copy Markdown
Member

SimonCropp and others added 29 commits August 8, 2026 09:17
Inline snapshots become a mode rather than a dedicated entry point:

* VerifierSettings.Inline(), optionally taking a GlobalInline delegate, turns
  them on for every verification from a module initializer.
* VerifySettings.NotInline() and SettingsTask.NotInline() opt one test out.
* VerifySettings.Inline(...) becomes Snapshot(...), and gains a fluent
  SettingsTask counterpart, so the literal composes with every overload rather
  than only the two VerifyInline had.
* Target.DontInline lets a converter say that inlining the first of its targets
  makes no sense, eg a document split into one markdown target per page.

A snapshot that has never been accepted has no Snapshot(...) call to find, so
the patcher needs the line of the verify call itself. That means
[CallerLineNumber] on every Verify* entry point across the six adapters, both
the Verifier and VerifyBase families, and on Combination. The adapters' private
Verify helper takes it as a required parameter so the compiler catches any entry
point that forgets to pass it on.

Also fixes VerifyNUnit.VerifyBase.VerifyFile, which passed sourceFile into the
extension parameter positionally. XunitV3 and MSTest already passed the null
that NUnit was missing; all three now use named arguments.

VerifyInline is removed. InlineTests and IgnoreTrailingNewlineTests still
reference it and are converted next.
InlineEngine was a parallel implementation of VerifyEngine: its own deletes,
auto verify, exception message, and a Render that concatenated every target
into one document with ---------- separators. That last part is what made
inline all-or-nothing.

It is now a component that VerifyEngine owns and drives for one target. The
grouping and #00 indexing run over the full target list and the inlined
target's file work is skipped, so the remaining targets keep the names they
would have had with no literal at all, leaving a deliberate gap where the
inlined target's file would be. Cleanup on migration falls out of that: the
inlined target never claims its verified file, so a stale one flows through
the normal delete path.

Build and BuildInline merge into one builder, because a verification can now
fail on the literal and on a file in the same run. The parser already modelled
both section sets, so it needed no change, only a sample carrying both.

Resolution lives in InnerVerifier, in order: NotInline wins, then an explicit
Snapshot(...), then the global switch, which declines rather than throws for
UseUniqueDirectory, a non-C# source, the third party InnerVerifier ctor and
Target.DontInline. Once inline is on, a non-text first target throws and names
both escapes. A literal that survives with inline off migrates the other way:
the Snapshot call is stripped and the snapshot goes back to a file.

Requires DiffEngine 20.0.0-beta.5, which is not published yet.
The switch is static, so its tests live in StaticSettingsTests where BaseTest
resets it between serial tests. They cover on, off, the delegate's context and
its filtering, NotInline at both instance and fluent level, Target.DontInline,
a non-text first target, UseUniqueDirectory declining quietly, and that only
the first target is inlined.

The verify calls in those tests are real inline call sites in their own source
file. Nothing rewrites them: AutoVerify is off, so the only accept path is a
review, and DiffRunner is disabled for the duration so no patch is sent.

VerifierSettings.Reset now clears the switch, without which one test would leak
into the next.
The blank line after the inline block exists to separate it from the New: and
NotEqual: blocks below. With nothing below it was a trailing newline, changing
an inline-only message that had not otherwise changed.
The two text nodes under <ItemGroup> caused MSB4067, which dropped all
PackageVersion items and broke restore with NU1015 across every project.
@SimonCropp
SimonCropp merged commit c7b332d into main Aug 10, 2026
5 checks passed
This was referenced Aug 27, 2026
tom-wolfe pushed a commit to tom-wolfe/Wolfe.CommandLine that referenced this pull request Aug 27, 2026
Updated [Verify.XunitV3](https://github.com/VerifyTests/Verify) from
31.28.0 to 32.0.0.

<details>
<summary>Release notes</summary>

_Sourced from [Verify.XunitV3's
releases](https://github.com/VerifyTests/Verify/releases)._

## 32.0.0

- [x] [#​1832](VerifyTests/Verify#1832) Add
Inline snpashot support
- [x] [#​1835](VerifyTests/Verify#1835) Add
SettingsTask.AddContext
- [x] [#​1847](VerifyTests/Verify#1847) Honor
explicit DefaultValueHandling for bools
- [x] [#​1850](VerifyTests/Verify#1850) Stray
extension-less snapshot file crashes every run of its test
- [x] [#​1851](VerifyTests/Verify#1851) Static
UniqueForTargetFramework(Assembly) overloads ignore the assembly passed
to them
- [x] [#​1852](VerifyTests/Verify#1852)
Appended files skip scrubbing and newline normalization when a stream
converter is registered
- [x] [#​1853](VerifyTests/Verify#1853)
IgnoreParameters() ignore-all sentinel is lost when combined with
another ignore source
- [x] [#​1854](VerifyTests/Verify#1854) Format
UTC offsets with the invariant culture
- [x] [#​1855](VerifyTests/Verify#1855) Format
UTC offsets with invariant culture
- [x] [#​1856](VerifyTests/Verify#1856) Use
ticks to decide date precision
- [x] [#​1857](VerifyTests/Verify#1857) Clean #
out of file name parameters
- [x] [#​1858](VerifyTests/Verify#1858) Escape
one character trimmed date formats
- [x] [#​1859](VerifyTests/Verify#1859) Prefer
the exact type when resolving a member converter
- [x] [#​1860](VerifyTests/Verify#1860) Keep
empty collections ignored alongside instance predicates
- [x] [#​1861](VerifyTests/Verify#1861) Key the
combinations name cache by reference
- [x] [#​1862](VerifyTests/Verify#1862) Match
MSTest overloads against the test data
- [x] [#​1863](VerifyTests/Verify#1863) Report
deletes as directory relative paths
- [x] [#​1864](VerifyTests/Verify#1864) Name the
guarded API in ThrowIfVerifyHasBeenRun
- [x] [#​1865](VerifyTests/Verify#1865) Keep
stack frames that have no parameter list
- [x] [#​1866](VerifyTests/Verify#1866) Generate
the TestContext property for record test classes
- [x] [#​1867](VerifyTests/Verify#1867) Fix two
CombinationResultsConverter edge cases
- [x] [#​1868](VerifyTests/Verify#1868) Sign
sub-hour UTC offsets
- [x] [#​1869](VerifyTests/Verify#1869) Write
the received file from the stream for handle based FileStreams
- [x] [#​1870](VerifyTests/Verify#1870) Compare
prefixes ignoring case
- [x] [#​1871](VerifyTests/Verify#1871) Guard
the counter value caches with a lock
- [x] [#​1872](VerifyTests/Verify#1872) Sign
sub-hour UTC offsets

## 32.0.0-beta.16



## 32.0.0-beta.15



## 32.0.0-beta.14



## 32.0.0-beta.13



## 32.0.0-beta.12



## 32.0.0-beta.10



## 32.0.0-beta.8



## 32.0.0-beta.7



## 32.0.0-beta.6



## 32.0.0-beta.5



## 32.0.0-beta.4



## 32.0.0-beta.3



## 32.0.0-beta.2



## 32.0.0-beta.1



Commits viewable in [compare
view](VerifyTests/Verify@31.28.0...32.0.0).
</details>

[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=Verify.XunitV3&package-manager=nuget&previous-version=31.28.0&new-version=32.0.0)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot show <dependency name> ignore conditions` will show all
of the ignore conditions of the specified dependency
- `@dependabot ignore <dependency name> major version` will close this
group update PR and stop Dependabot creating any more for the specific
dependency's major version (unless you unignore this specific
dependency's major version or upgrade to it yourself)
- `@dependabot ignore <dependency name> minor version` will close this
group update PR and stop Dependabot creating any more for the specific
dependency's minor version (unless you unignore this specific
dependency's minor version or upgrade to it yourself)
- `@dependabot ignore <dependency name>` will close this group update PR
and stop Dependabot creating any more for the specific dependency
(unless you unignore this specific dependency or upgrade to it yourself)
- `@dependabot unignore <dependency name>` will remove all of the ignore
conditions of the specified dependency
- `@dependabot unignore <dependency name> <ignore condition>` will
remove the ignore condition of the specified dependency and ignore
conditions


</details>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
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.

2 participants