From 2732f1f40a09dede0d90e52ecdca361d6208b1ba Mon Sep 17 00:00:00 2001 From: Raphael Strotz <17022099+Xzelsius@users.noreply.github.com> Date: Thu, 7 Nov 2024 17:50:55 +0100 Subject: [PATCH] test: cover case-sensitive comparison (#124) Co-authored-by: Raphael Strotz --- .../IgnoreCaseWhenPossibleComparer.cs | 27 +++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/test/Ayaka.Nuke.Tests/PublicApi/IgnoreCaseWhenPossibleComparer.cs b/test/Ayaka.Nuke.Tests/PublicApi/IgnoreCaseWhenPossibleComparer.cs index e95542c..b57b802 100644 --- a/test/Ayaka.Nuke.Tests/PublicApi/IgnoreCaseWhenPossibleComparer.cs +++ b/test/Ayaka.Nuke.Tests/PublicApi/IgnoreCaseWhenPossibleComparer.cs @@ -15,7 +15,7 @@ public void Does_sort_lines() "Ayaka.Nuke.DotNet.IHaveDotNetPackTarget", "Ayaka.Nuke.DotNet.ICanDotNetBuild.DotNetBuildSettingsBase.get -> Nuke.Common.Tooling.Configure!", "Ayaka.Nuke.DotNet.ICanDotNetBuild", - "ayaka.nuke.extensions", + "Ayaka.Nuke.Extensions", "Ayaka.Nuke.DotNet.ICanDotNetBuild.DotNetBuildSettings.get -> Nuke.Common.Tooling.Configure!" ]; @@ -30,7 +30,30 @@ public void Does_sort_lines() "Ayaka.Nuke.DotNet.ICanDotNetBuild.DotNetBuildSettings.get -> Nuke.Common.Tooling.Configure!", "Ayaka.Nuke.DotNet.ICanDotNetBuild.DotNetBuildSettingsBase.get -> Nuke.Common.Tooling.Configure!", "Ayaka.Nuke.DotNet.IHaveDotNetPackTarget", - "ayaka.nuke.extensions" + "Ayaka.Nuke.Extensions" + ], + o => o.WithStrictOrdering()); + } + + [Fact] + public void Does_fallback_to_case_sensitive() + { + List lines = + [ + "ayaka.nuke.extensions", + "Ayaka.Nuke.DotNet.ICanDotNetBuild", + "Ayaka.Nuke.Extensions" + ]; + + lines.Sort(IgnoreCaseWhenPossibleComparer.Instance); + + lines + .Should() + .BeEquivalentTo( + [ + "Ayaka.Nuke.DotNet.ICanDotNetBuild", + "Ayaka.Nuke.Extensions", + "ayaka.nuke.extensions", ], o => o.WithStrictOrdering()); }