mirror of
https://github.com/MindWorkAI/AI-Studio.git
synced 2026-11-13 17:47:21 +00:00
Fixed line endings in the reflection folder and tests on Windows (#1192)
This commit is contained in:
1 parent
6f187f1bd8
commit
b1c1f13993
7 files changed
+157
-22
No files matched your search
@@ -101,7 +101,8 @@ public sealed class I18NSourceScannerTests
|
||||
|
||||
var texts = I18NSourceScanner.FindTexts(SOURCE, "Notice.cs", []);
|
||||
|
||||
Assert.That(texts.Select(text => text.Text), Is.EqualTo(new[] { "## Welcome!\n\nThe first paragraph." }));
|
||||
// The scanner keeps the line endings of the checkout, as the compiler does, and the collector makes them equal:
|
||||
Assert.That(texts.Select(text => I18NKeyHash.NormalizeLineEndings(text.Text)), Is.EqualTo(new[] { "## Welcome!\n\nThe first paragraph." }));
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
||||
@@ -0,0 +1,46 @@
|
||||
using System.Globalization;
|
||||
using System.Text;
|
||||
|
||||
using SharedTools;
|
||||
|
||||
namespace AIStudio.Tests.Tools;
|
||||
|
||||
/// <summary>
|
||||
/// Checks that AppendLineLF ends every line with LF, whatever the system.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// StringBuilder.AppendLine writes CR LF on Windows. These tests would show it there, while on macOS and Linux they
|
||||
/// pass with both.
|
||||
/// </remarks>
|
||||
[TestFixture]
|
||||
public sealed class StringBuilderExtensionsTests
|
||||
{
|
||||
[Test]
|
||||
public void EveryKindOfLineEndsWithLf()
|
||||
{
|
||||
var number = 4711;
|
||||
var text = new StringBuilder()
|
||||
.AppendLineLF("Erste Zeile")
|
||||
.AppendLineLF()
|
||||
.AppendLineLF($"Nummer {number}")
|
||||
.AppendLineLF(null)
|
||||
.ToString();
|
||||
|
||||
Assert.That(text, Is.EqualTo("Erste Zeile\n\nNummer 4711\n\n"));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void AnInterpolatedTextGoesIntoTheSameBuilderInItsPlace()
|
||||
{
|
||||
var value = 1.5;
|
||||
var builder = new StringBuilder("Anfang ");
|
||||
|
||||
var returned = builder.AppendLineLF($"{value.ToString(CultureInfo.InvariantCulture)} und {"Text"}").Append("Ende");
|
||||
|
||||
using (Assert.EnterMultipleScope())
|
||||
{
|
||||
Assert.That(returned, Is.SameAs(builder));
|
||||
Assert.That(builder.ToString(), Is.EqualTo("Anfang 1.5 und Text\nEnde"));
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user