diff options
author | Nina Chikanov <nchikanov@gmail.com> | 2017-07-18 03:11:09 +0300 |
---|---|---|
committer | Jeremy Kuhne <jeremy.kuhne@microsoft.com> | 2017-07-18 03:11:09 +0300 |
commit | 88ece1d0c6a247c669831f15929d2bb271bba26e (patch) | |
tree | b354ea9adc20fac299b08456722ff62abf656bcf /src/System.Runtime.Extensions | |
parent | a88919cfea0549a7fd4cc65e361ee0f4ac9475e1 (diff) |
Update tests for pending whitespace trimming changes (#22341)
* Update tests for pending whitespace trimming changes coreclr/#12862
* Fix attribute for ActiveIssue
Diffstat (limited to 'src/System.Runtime.Extensions')
-rw-r--r-- | src/System.Runtime.Extensions/tests/System/IO/PathTests.cs | 47 |
1 files changed, 46 insertions, 1 deletions
diff --git a/src/System.Runtime.Extensions/tests/System/IO/PathTests.cs b/src/System.Runtime.Extensions/tests/System/IO/PathTests.cs index c344c5ba18..166218e9fb 100644 --- a/src/System.Runtime.Extensions/tests/System/IO/PathTests.cs +++ b/src/System.Runtime.Extensions/tests/System/IO/PathTests.cs @@ -45,6 +45,26 @@ namespace System.IO.Tests } [Theory] + [InlineData("\u00A0")] // Non-breaking Space + [InlineData("\u2028")] // Line separator + [InlineData("\u2029")] // Paragraph separator + [ActiveIssue(21358)] // Pending CoreCLR behavior change + public static void GetDirectoryName_NonControl(string path) + { + Assert.Equal(string.Empty, Path.GetDirectoryName(path)); + } + + [Theory] + [InlineData("\u00A0")] // Non-breaking Space + [InlineData("\u2028")] // Line separator + [InlineData("\u2029")] // Paragraph separator + [ActiveIssue(21358)] // Pending CoreCLR behavior change + public static void GetDirectoryName_NonControlWithSeparator(string path) + { + Assert.Equal(path, Path.GetDirectoryName(Path.Combine(path, path))); + } + + [Theory] [InlineData(null, null)] [InlineData(".", "")] [InlineData("..", "")] @@ -416,8 +436,33 @@ namespace System.IO.Tests } } - [Fact] + [Theory] + [InlineData("\u0085")] // Next line + [InlineData("\u00A0")] // Non breaking space + [InlineData("\u2028")] // Line separator + [PlatformSpecific(TestPlatforms.Windows)] + [ActiveIssue(21358)] // Pending CoreCLR behavior change + [SkipOnTargetFramework(TargetFrameworkMonikers.NetFramework)] // not NetFX + public static void GetFullPath_NonControlWhiteSpaceStays(string component) + { + // When not NetFX full path should not cut off component + string path = "C:\\Test" + component; + Assert.Equal(path, Path.GetFullPath(path)); + } + + [Theory] + [InlineData(" ")] + [InlineData(" ")] + [InlineData(" ")] + [PlatformSpecific(TestPlatforms.Windows)] + public static void GetFullPath_TrailingSpaceCut(string component) + { + // Windows cuts off any simple white space added to a path + string path = "C:\\Test" + component; + Assert.Equal("C:\\Test", Path.GetFullPath(path)); + } + [Fact] public static void GetFullPath_InvalidArgs() { Assert.Throws<ArgumentNullException>(() => Path.GetFullPath(null)); |