Skip to content

Commit

Permalink
add missing scrubbing overloads (#1138)
Browse files Browse the repository at this point in the history
  • Loading branch information
SimonCropp authored Feb 3, 2024
1 parent dfa2b38 commit da8db15
Show file tree
Hide file tree
Showing 2 changed files with 91 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<Project>
<PropertyGroup>
<NoWarn>CS1591;CS0649;xUnit1026;xUnit1013;CS1573;VerifyTestsProjectDir;VerifySetParameters</NoWarn>
<Version>23.0.1</Version>
<Version>23.1.0</Version>
<ImplicitUsings>enable</ImplicitUsings>
<LangVersion>preview</LangVersion>
<AssemblyVersion>1.0.0</AssemblyVersion>
Expand Down
90 changes: 90 additions & 0 deletions src/Verify/SettingsTask_Scrubbing.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,16 @@ public SettingsTask ScrubInlineGuids(ScrubberLocation location = ScrubberLocatio
return this;
}

/// <summary>
/// Replace inline <see cref="Guid" />s with a placeholder.
/// </summary>
[Pure]
public SettingsTask ScrubInlineGuids(string extension, ScrubberLocation location = ScrubberLocation.First)
{
CurrentSettings.ScrubInlineGuids(extension, location);
return this;
}

/// <summary>
/// Disables counting of dates.
/// </summary>
Expand Down Expand Up @@ -86,6 +96,16 @@ public SettingsTask ScrubMachineName(ScrubberLocation location = ScrubberLocatio
return this;
}

/// <summary>
/// Remove the <see cref="Environment.MachineName" /> from the test results.
/// </summary>
[Pure]
public SettingsTask ScrubMachineName(string extension, ScrubberLocation location = ScrubberLocation.First)
{
CurrentSettings.ScrubMachineName(extension, location);
return this;
}

/// <summary>
/// Remove the <see cref="Environment.UserName" /> from the test results.
/// </summary>
Expand All @@ -96,6 +116,16 @@ public SettingsTask ScrubUserName(ScrubberLocation location = ScrubberLocation.F
return this;
}

/// <summary>
/// Remove the <see cref="Environment.UserName" /> from the test results.
/// </summary>
[Pure]
public SettingsTask ScrubUserName(string extension,ScrubberLocation location = ScrubberLocation.First)
{
CurrentSettings.ScrubUserName(extension, location);
return this;
}

/// <summary>
/// Remove any lines containing any of <paramref name="stringToMatch" /> from the test results.
/// </summary>
Expand All @@ -105,6 +135,15 @@ public SettingsTask ScrubLinesContaining(StringComparison comparison, params str
CurrentSettings.ScrubLinesContaining(comparison, stringToMatch);
return this;
}
/// <summary>
/// Remove any lines containing any of <paramref name="stringToMatch" /> from the test results.
/// </summary>
[Pure]
public SettingsTask ScrubLinesContaining(string extension, StringComparison comparison, params string[] stringToMatch)
{
CurrentSettings.ScrubLinesContaining(extension, comparison, stringToMatch);
return this;
}

/// <summary>
/// Remove any lines containing any of <paramref name="stringToMatch" /> from the test results.
Expand All @@ -116,6 +155,16 @@ public SettingsTask ScrubLinesContaining(StringComparison comparison, ScrubberLo
return this;
}

/// <summary>
/// Remove any lines containing any of <paramref name="stringToMatch" /> from the test results.
/// </summary>
[Pure]
public SettingsTask ScrubLinesContaining(string extension, StringComparison comparison, ScrubberLocation location = ScrubberLocation.First, params string[] stringToMatch)
{
CurrentSettings.ScrubLinesContaining(extension, comparison, location, stringToMatch);
return this;
}

/// <summary>
/// Remove any lines matching <paramref name="removeLine" /> from the test results.
/// </summary>
Expand All @@ -126,6 +175,16 @@ public SettingsTask ScrubLines(Func<string, bool> removeLine, ScrubberLocation l
return this;
}

/// <summary>
/// Remove any lines matching <paramref name="removeLine" /> from the test results.
/// </summary>
[Pure]
public SettingsTask ScrubLines(string extension, Func<string, bool> removeLine, ScrubberLocation location = ScrubberLocation.First)
{
CurrentSettings.ScrubLines(extension, removeLine, location);
return this;
}

/// <summary>
/// Scrub lines with an optional replace.
/// <paramref name="replaceLine" /> can return the input to ignore the line, or return a different string to replace it.
Expand All @@ -137,6 +196,17 @@ public SettingsTask ScrubLinesWithReplace(Func<string, string?> replaceLine, Scr
return this;
}

/// <summary>
/// Scrub lines with an optional replace.
/// <paramref name="replaceLine" /> can return the input to ignore the line, or return a different string to replace it.
/// </summary>
[Pure]
public SettingsTask ScrubLinesWithReplace(string extension, Func<string, string?> replaceLine, ScrubberLocation location = ScrubberLocation.First)
{
CurrentSettings.ScrubLinesWithReplace(extension, replaceLine, location);
return this;
}

/// <summary>
/// Remove any lines containing only whitespace from the test results.
/// </summary>
Expand All @@ -147,6 +217,16 @@ public SettingsTask ScrubEmptyLines(ScrubberLocation location = ScrubberLocation
return this;
}

/// <summary>
/// Remove any lines containing only whitespace from the test results.
/// </summary>
[Pure]
public SettingsTask ScrubEmptyLines(string extension, ScrubberLocation location = ScrubberLocation.First)
{
CurrentSettings.ScrubEmptyLines(extension, location);
return this;
}

/// <summary>
/// Remove any lines containing any of <paramref name="stringToMatch" /> from the test results.
/// </summary>
Expand All @@ -166,4 +246,14 @@ public SettingsTask ScrubLinesContaining(ScrubberLocation location = ScrubberLoc
CurrentSettings.ScrubLinesContaining(location, stringToMatch);
return this;
}

/// <summary>
/// Remove any lines containing any of <paramref name="stringToMatch" /> from the test results.
/// </summary>
[Pure]
public SettingsTask ScrubLinesContaining(string extension, ScrubberLocation location = ScrubberLocation.First, params string[] stringToMatch)
{
CurrentSettings.ScrubLinesContaining(extension, location, stringToMatch);
return this;
}
}

0 comments on commit da8db15

Please sign in to comment.