summaryrefslogtreecommitdiff
path: root/src/SMAPI.Tests/Core
diff options
context:
space:
mode:
authoratravita-mods <94934860+atravita-mods@users.noreply.github.com>2022-10-16 18:04:19 -0400
committeratravita-mods <94934860+atravita-mods@users.noreply.github.com>2022-10-16 18:04:19 -0400
commit4dcc6904b9e72ac3567dfafe3824c2de48218b58 (patch)
tree27f1fd4f06be1aa544426601d399c93193a1b546 /src/SMAPI.Tests/Core
parent573f732c2a2118d7a4848151764df6bef1a47008 (diff)
downloadSMAPI-4dcc6904b9e72ac3567dfafe3824c2de48218b58.tar.gz
SMAPI-4dcc6904b9e72ac3567dfafe3824c2de48218b58.tar.bz2
SMAPI-4dcc6904b9e72ac3567dfafe3824c2de48218b58.zip
fix issues with subfolders
Diffstat (limited to 'src/SMAPI.Tests/Core')
-rw-r--r--src/SMAPI.Tests/Core/AssetNameTests.cs14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/SMAPI.Tests/Core/AssetNameTests.cs b/src/SMAPI.Tests/Core/AssetNameTests.cs
index 655e9bae..fe70e330 100644
--- a/src/SMAPI.Tests/Core/AssetNameTests.cs
+++ b/src/SMAPI.Tests/Core/AssetNameTests.cs
@@ -243,6 +243,20 @@ namespace SMAPI.Tests.Core
return result;
}
+ [TestCase("Mods/SomeMod/SomeSubdirectory", "Mods/Some", true, ExpectedResult = true)]
+ [TestCase("Mods/SomeMod/SomeSubdirectory", "Mods/Some", false, ExpectedResult = false)]
+ public bool StartsWith_SubfolderWithPartial(string mainAssetName, string otherAssetName, bool allowSubfolder)
+ {
+ // arrange
+ mainAssetName = PathUtilities.NormalizeAssetName(mainAssetName);
+
+ // act
+ AssetName name = AssetName.Parse(mainAssetName, _ => null);
+
+ // assert value
+ return name.StartsWith(otherAssetName, allowPartialWord: true, allowSubfolder: allowSubfolder);
+ }
+
/****
** GetHashCode