Skip to content

Commit

Permalink
move appender ignore to serialization stage (#1337)
Browse files Browse the repository at this point in the history
  • Loading branch information
SimonCropp authored Nov 1, 2024
1 parent e1e1910 commit 664a79a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 18 deletions.
5 changes: 5 additions & 0 deletions src/Verify/Serialization/InfoBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,11 @@ public override void Write(VerifyJsonWriter writer, InfoBuilder value)

foreach (var item in value.inner)
{
if (writer.serialization.ShouldIgnoreByName(item.Key))
{
continue;
}

writer.WritePropertyName(item.Key);
if (writer.serialization.ShouldScrubByName(item.Key))
{
Expand Down
21 changes: 3 additions & 18 deletions src/Verify/Splitters/Settings_JsonAppender.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,7 @@ internal static List<ToAppend> GetJsonAppenders(VerifySettings settings)

if (Recording.TryStop(out var recorded))
{
foreach (var append in recorded)
{
if (!settings.serialization.ShouldIgnoreByName(append.Name))
{
list.Add(append);
}
}
list.AddRange(recorded);
}

foreach (var appender in jsonAppenders)
Expand All @@ -25,21 +19,12 @@ internal static List<ToAppend> GetJsonAppenders(VerifySettings settings)
if (data is not null)
{
var append = data.Value;
if (!settings.serialization.ShouldIgnoreByName(append.Name))
{
list.Add(append);
}
}
}

foreach (var append in settings.Appends)
{
if (!settings.serialization.ShouldIgnoreByName(append.Name))
{
list.Add(append);
}
}

list.AddRange(settings.Appends);

return list;
}

Expand Down

0 comments on commit 664a79a

Please sign in to comment.