summaryrefslogtreecommitdiff
path: root/src/SMAPI.Tests
diff options
context:
space:
mode:
authorJesse Plamondon-Willard <Pathoschild@users.noreply.github.com>2020-09-08 18:17:09 -0400
committerJesse Plamondon-Willard <Pathoschild@users.noreply.github.com>2020-09-08 18:17:09 -0400
commit5433f9023ed174366c8bf450785aafbdb077d29d (patch)
tree3a4fc71371d5a1194c2f819444aa7fc32f739830 /src/SMAPI.Tests
parent8a51279ce943ff74b45ec7af308ecf59d73ace9b (diff)
parentd53e033163cfc4a876d6a3341979315a3d937a4f (diff)
downloadSMAPI-5433f9023ed174366c8bf450785aafbdb077d29d.tar.gz
SMAPI-5433f9023ed174366c8bf450785aafbdb077d29d.tar.bz2
SMAPI-5433f9023ed174366c8bf450785aafbdb077d29d.zip
Merge branch 'develop' into stable
Diffstat (limited to 'src/SMAPI.Tests')
-rw-r--r--src/SMAPI.Tests/Toolkit/PathUtilitiesTests.cs70
-rw-r--r--src/SMAPI.Tests/Utilities/PathUtilitiesTests.cs9
2 files changed, 2 insertions, 77 deletions
diff --git a/src/SMAPI.Tests/Toolkit/PathUtilitiesTests.cs b/src/SMAPI.Tests/Toolkit/PathUtilitiesTests.cs
deleted file mode 100644
index 55785bfa..00000000
--- a/src/SMAPI.Tests/Toolkit/PathUtilitiesTests.cs
+++ /dev/null
@@ -1,70 +0,0 @@
-using NUnit.Framework;
-using StardewModdingAPI.Toolkit.Utilities;
-
-namespace SMAPI.Tests.Toolkit
-{
- /// <summary>Unit tests for <see cref="PathUtilities"/>.</summary>
- [TestFixture]
- public class PathUtilitiesTests
- {
- /*********
- ** Unit tests
- *********/
- [Test(Description = "Assert that GetSegments returns the expected values.")]
- [TestCase("", ExpectedResult = "")]
- [TestCase("/", ExpectedResult = "")]
- [TestCase("///", ExpectedResult = "")]
- [TestCase("/usr/bin", ExpectedResult = "usr|bin")]
- [TestCase("/usr//bin//", ExpectedResult = "usr|bin")]
- [TestCase("/usr//bin//.././boop.exe", ExpectedResult = "usr|bin|..|.|boop.exe")]
- [TestCase(@"C:", ExpectedResult = "C:")]
- [TestCase(@"C:/boop", ExpectedResult = "C:|boop")]
- [TestCase(@"C:\boop\/usr//bin//.././boop.exe", ExpectedResult = "C:|boop|usr|bin|..|.|boop.exe")]
- public string GetSegments(string path)
- {
- return string.Join("|", PathUtilities.GetSegments(path));
- }
-
- [Test(Description = "Assert that NormalizePathSeparators returns the expected values.")]
-#if SMAPI_FOR_WINDOWS
- [TestCase("", ExpectedResult = "")]
- [TestCase("/", ExpectedResult = "")]
- [TestCase("///", ExpectedResult = "")]
- [TestCase("/usr/bin", ExpectedResult = @"usr\bin")]
- [TestCase("/usr//bin//", ExpectedResult = @"usr\bin")]
- [TestCase("/usr//bin//.././boop.exe", ExpectedResult = @"usr\bin\..\.\boop.exe")]
- [TestCase("C:", ExpectedResult = "C:")]
- [TestCase("C:/boop", ExpectedResult = @"C:\boop")]
- [TestCase(@"C:\usr\bin//.././boop.exe", ExpectedResult = @"C:\usr\bin\..\.\boop.exe")]
-#else
- [TestCase("", ExpectedResult = "")]
- [TestCase("/", ExpectedResult = "/")]
- [TestCase("///", ExpectedResult = "/")]
- [TestCase("/usr/bin", ExpectedResult = "/usr/bin")]
- [TestCase("/usr//bin//", ExpectedResult = "/usr/bin")]
- [TestCase("/usr//bin//.././boop.exe", ExpectedResult = "/usr/bin/.././boop.exe")]
- [TestCase("C:", ExpectedResult = "C:")]
- [TestCase("C:/boop", ExpectedResult = "C:/boop")]
- [TestCase(@"C:\usr\bin//.././boop.exe", ExpectedResult = "C:/usr/bin/.././boop.exe")]
-#endif
- public string NormalizePathSeparators(string path)
- {
- return PathUtilities.NormalizePathSeparators(path);
- }
-
- [Test(Description = "Assert that GetRelativePath returns the expected values.")]
-#if SMAPI_FOR_WINDOWS
- [TestCase(@"C:\", @"C:\", ExpectedResult = "./")]
- [TestCase(@"C:\grandparent\parent\child", @"C:\grandparent\parent\sibling", ExpectedResult = @"..\sibling")]
- [TestCase(@"C:\grandparent\parent\child", @"C:\cousin\file.exe", ExpectedResult = @"..\..\..\cousin\file.exe")]
-#else
- [TestCase("/", "/", ExpectedResult = "./")]
- [TestCase("/grandparent/parent/child", "/grandparent/parent/sibling", ExpectedResult = "../sibling")]
- [TestCase("/grandparent/parent/child", "/cousin/file.exe", ExpectedResult = "../../../cousin/file.exe")]
-#endif
- public string GetRelativePath(string sourceDir, string targetPath)
- {
- return PathUtilities.GetRelativePath(sourceDir, targetPath);
- }
- }
-}
diff --git a/src/SMAPI.Tests/Utilities/PathUtilitiesTests.cs b/src/SMAPI.Tests/Utilities/PathUtilitiesTests.cs
index ea69a9ea..b5494003 100644
--- a/src/SMAPI.Tests/Utilities/PathUtilitiesTests.cs
+++ b/src/SMAPI.Tests/Utilities/PathUtilitiesTests.cs
@@ -179,10 +179,10 @@ namespace SMAPI.Tests.Utilities
****/
[Test(Description = "Assert that PathUtilities.NormalizePathSeparators normalizes paths correctly.")]
[TestCaseSource(nameof(PathUtilitiesTests.SamplePaths))]
- public void NormalizePathSeparators(SamplePath path)
+ public void NormalizePath(SamplePath path)
{
// act
- string normalized = PathUtilities.NormalizePathSeparators(path.OriginalPath);
+ string normalized = PathUtilities.NormalizePath(path.OriginalPath);
// assert
#if SMAPI_FOR_WINDOWS
@@ -218,11 +218,6 @@ namespace SMAPI.Tests.Utilities
ExpectedResult = @"path\to\child"
)]
[TestCase(
- @"\\parent\unc",
- @"\\adjacent\unc",
- ExpectedResult = @"\\adjacent\unc"
- )]
- [TestCase(
@"C:\same\path",
@"C:\same\path",
ExpectedResult = @"."