-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
1100f4e
commit f3cf844
Showing
26 changed files
with
936 additions
and
925 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
using System; | ||
using NUnit.Framework; | ||
// ReSharper disable NotAccessedPositionalProperty.Local | ||
// ReSharper disable ArgumentsStyleStringLiteral | ||
// ReSharper disable ArgumentsStyleLiteral | ||
|
||
namespace Tababular.Tests.Bugs; | ||
|
||
[TestFixture] | ||
public class TestRecordsAndStuff | ||
{ | ||
[Test] | ||
public void CanDoIt() | ||
{ | ||
var formatter = new TableFormatter(); | ||
|
||
var records = new[] | ||
{ | ||
new SomeRecordThing(Number: 21, Text: "Big Number"), | ||
new SomeRecordThing(Number: 5, Text: "Small Number"), | ||
new SomeRecordThing(Number: 12, Text: "Medium Number") | ||
}; | ||
|
||
var text = formatter.FormatObjects(records); | ||
|
||
Console.WriteLine(text); | ||
} | ||
|
||
record SomeRecordThing(int Number, string Text); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,18 @@ | ||
using System; | ||
using System.Linq; | ||
|
||
namespace Tababular.Tests.Ex | ||
namespace Tababular.Tests.Ex; | ||
|
||
public static class StringExtensions | ||
{ | ||
public static class StringExtensions | ||
public static string Normalized(this string str) | ||
{ | ||
public static string Normalized(this string str) | ||
{ | ||
var lines = str.Split(new[] {Environment.NewLine, "\r", "\n"}, StringSplitOptions.None) | ||
.SkipWhile(string.IsNullOrWhiteSpace) | ||
.Reverse() | ||
.SkipWhile(string.IsNullOrWhiteSpace) | ||
.Reverse(); | ||
var lines = str.Split(new[] {Environment.NewLine, "\r", "\n"}, StringSplitOptions.None) | ||
.SkipWhile(string.IsNullOrWhiteSpace) | ||
.Reverse() | ||
.SkipWhile(string.IsNullOrWhiteSpace) | ||
.Reverse(); | ||
|
||
return string.Join(Environment.NewLine, lines.Select(l => l.TrimEnd())); | ||
} | ||
} | ||
return string.Join(Environment.NewLine, lines.Select(l => l.TrimEnd())); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.