From f3c98a64a25c0b66a28236a14753f48d2de6611c Mon Sep 17 00:00:00 2001 From: Valentin Tyrichev Date: Tue, 10 Dec 2024 11:03:44 +0400 Subject: [PATCH] Diamond tests adjustment (#2345) * Updated DiamondTests.cs `Rows` method adjusted to use system dependent new line characters. * DiamondTests.Rows method adjusted to be line-ending tolerant. --- exercises/practice/diamond/DiamondTests.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/exercises/practice/diamond/DiamondTests.cs b/exercises/practice/diamond/DiamondTests.cs index fa8342551e..f712fd3f18 100644 --- a/exercises/practice/diamond/DiamondTests.cs +++ b/exercises/practice/diamond/DiamondTests.cs @@ -7,7 +7,7 @@ public class DiamondTests { public static readonly char[] AllLetters = GetLetterRange('A', 'Z'); - private static string[] Rows(string x) => x.Split(new[] { '\n' }, StringSplitOptions.None); + private static string[] Rows(string x) => x.Split('\n').Select(line => line.TrimEnd('\r')).ToArray(); private static string LeadingSpaces(string x) => x.Substring(0, x.IndexOfAny(AllLetters)); private static string TrailingSpaces(string x) => x.Substring(x.LastIndexOfAny(AllLetters) + 1); @@ -125,4 +125,4 @@ public static Arbitrary Chars() { return Arb.Default.Char().Filter(x => x >= 'A' && x <= 'Z'); } -} \ No newline at end of file +}