From 178e1e7039fcdc1c4a6119fccf25546695a0b6e1 Mon Sep 17 00:00:00 2001 From: BDisp Date: Wed, 12 Nov 2025 16:49:08 +0000 Subject: [PATCH] Add unit test to prove that null and empty string doesn't not throws anything. --- Tests/UnitTestsParallelizable/Text/StringTests.cs | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/Tests/UnitTestsParallelizable/Text/StringTests.cs b/Tests/UnitTestsParallelizable/Text/StringTests.cs index 1c77e7564..80c52b96e 100644 --- a/Tests/UnitTestsParallelizable/Text/StringTests.cs +++ b/Tests/UnitTestsParallelizable/Text/StringTests.cs @@ -64,4 +64,19 @@ public class StringTests var str = "\u200D"; Assert.Equal (0, str.GetColumns ()); } + + [Theory] + [InlineData (null)] + [InlineData ("")] + public void TestGetColumns_Does_Not_Throws_With_Null_And_Empty_String (string? text) + { + if (text is null) + { + Assert.Equal (0, StringExtensions.GetColumns (text!)); + } + else + { + Assert.Equal (0, text.GetColumns ()); + } + } }