mirror of
https://github.com/SabreTools/SabreTools.RedumpLib.git
synced 2026-02-13 13:46:13 +00:00
Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
10eecc866e | ||
|
|
84fa2f93ea |
@@ -848,25 +848,25 @@ namespace SabreTools.RedumpLib.Test
|
||||
|
||||
#endregion
|
||||
|
||||
#region RemoveConsecutiveNewlines
|
||||
#region RemoveConsecutiveEmptyLines
|
||||
|
||||
[Fact]
|
||||
public void RemoveConsecutiveNewlines_Linux_Removed()
|
||||
public void RemoveConsecutiveEmptyLines_Linux_Removed()
|
||||
{
|
||||
string expected = "data\nbase";
|
||||
string expected = "data\n\nbase";
|
||||
string newlines = "data\n\n\n\n\n\n\n\n\n\nbase";
|
||||
|
||||
string actual = Formatter.RemoveConsecutiveNewlines(newlines);
|
||||
string actual = Formatter.RemoveConsecutiveEmptyLines(newlines);
|
||||
Assert.Equal(expected, actual);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void RemoveConsecutiveNewlines_Windows_Removed()
|
||||
public void RemoveConsecutiveEmptyLines_Windows_Removed()
|
||||
{
|
||||
string expected = "data\r\nbase";
|
||||
string expected = "data\r\n\r\nbase";
|
||||
string newlines = "data\r\n\r\n\r\n\r\n\r\nbase";
|
||||
|
||||
string actual = Formatter.RemoveConsecutiveNewlines(newlines);
|
||||
string actual = Formatter.RemoveConsecutiveEmptyLines(newlines);
|
||||
Assert.Equal(expected, actual);
|
||||
}
|
||||
|
||||
|
||||
@@ -175,7 +175,7 @@ namespace SabreTools.RedumpLib
|
||||
status = "Formatting complete!";
|
||||
|
||||
// Make sure there aren't any instances of two blank lines in a row
|
||||
return RemoveConsecutiveNewlines(output.ToString());
|
||||
return RemoveConsecutiveEmptyLines(output.ToString());
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
@@ -754,10 +754,10 @@ namespace SabreTools.RedumpLib
|
||||
/// <summary>
|
||||
/// Make sure there aren't any instances of two blank lines in a row
|
||||
/// </summary>
|
||||
internal static string RemoveConsecutiveNewlines(string str)
|
||||
internal static string RemoveConsecutiveEmptyLines(string str)
|
||||
{
|
||||
str = Regex.Replace(str, @"(\r\n)+", "\r\n");
|
||||
return Regex.Replace(str, @"(\n)+", "\n");
|
||||
str = Regex.Replace(str, @"(\r\n){2,}", "\r\n\r\n");
|
||||
return Regex.Replace(str, @"(\n){2,}", "\n\n");
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<LangVersion>latest</LangVersion>
|
||||
<Nullable>enable</Nullable>
|
||||
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
|
||||
<Version>1.6.0</Version>
|
||||
<Version>1.6.1</Version>
|
||||
|
||||
<!-- Package Properties -->
|
||||
<Authors>Matt Nadareski</Authors>
|
||||
|
||||
Reference in New Issue
Block a user