Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/corefx.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsepidehMS <sekho@microsoft.com>2017-02-07 00:28:24 +0300
committersepidehMS <sekho@microsoft.com>2017-02-08 02:46:26 +0300
commit493cb79ff4976479be5cc7c6f1fe2d5d9b710425 (patch)
treeca95a1b72112f67cf8784c3f2bfa4eb5eeec630c /src/System.Runtime.Extensions/tests
parentec6a6de7d69a3000866e177a5bcb7354ea96d05e (diff)
Add comments to PlatformSpecific tests
Diffstat (limited to 'src/System.Runtime.Extensions/tests')
-rw-r--r--src/System.Runtime.Extensions/tests/System/Environment.NewLine.cs4
-rw-r--r--src/System.Runtime.Extensions/tests/System/Environment.ProcessorCount.cs4
-rw-r--r--src/System.Runtime.Extensions/tests/System/EnvironmentTests.cs16
-rw-r--r--src/System.Runtime.Extensions/tests/System/IO/Path.Combine.cs4
-rw-r--r--src/System.Runtime.Extensions/tests/System/IO/Path.GetRelativePath.cs12
-rw-r--r--src/System.Runtime.Extensions/tests/System/IO/PathTests.cs52
6 files changed, 46 insertions, 46 deletions
diff --git a/src/System.Runtime.Extensions/tests/System/Environment.NewLine.cs b/src/System.Runtime.Extensions/tests/System/Environment.NewLine.cs
index a5cdcf83c7..4791c02ff4 100644
--- a/src/System.Runtime.Extensions/tests/System/Environment.NewLine.cs
+++ b/src/System.Runtime.Extensions/tests/System/Environment.NewLine.cs
@@ -8,14 +8,14 @@ namespace System.Tests
{
public class EnvironmentNewLine
{
- [PlatformSpecific(TestPlatforms.Windows)]
+ [PlatformSpecific(TestPlatforms.Windows)] // NewLine character on Windows
[Fact]
public void Windows_NewLineTest()
{
Assert.Equal("\r\n", Environment.NewLine);
}
- [PlatformSpecific(TestPlatforms.AnyUnix)]
+ [PlatformSpecific(TestPlatforms.AnyUnix)] // NewLine character on Unix
[Fact]
public void Unix_NewLineTest()
{
diff --git a/src/System.Runtime.Extensions/tests/System/Environment.ProcessorCount.cs b/src/System.Runtime.Extensions/tests/System/Environment.ProcessorCount.cs
index 8e7f0484b0..22e3c4dc5a 100644
--- a/src/System.Runtime.Extensions/tests/System/Environment.ProcessorCount.cs
+++ b/src/System.Runtime.Extensions/tests/System/Environment.ProcessorCount.cs
@@ -9,7 +9,7 @@ namespace System.Tests
{
public class EnvironmentProcessorCount
{
- [PlatformSpecific(TestPlatforms.Windows)]
+ [PlatformSpecific(TestPlatforms.Windows)] // Uses P/Invokes to get processor information
[Fact]
public void Windows_ProcessorCountTest()
{
@@ -26,7 +26,7 @@ namespace System.Tests
Assert.Equal(expected, actual);
}
- [PlatformSpecific(TestPlatforms.AnyUnix)]
+ [PlatformSpecific(TestPlatforms.AnyUnix)] // Uses P/Invokes to get processor information
[Fact]
public void Unix_ProcessorCountTest()
{
diff --git a/src/System.Runtime.Extensions/tests/System/EnvironmentTests.cs b/src/System.Runtime.Extensions/tests/System/EnvironmentTests.cs
index 4825078092..799c2453ef 100644
--- a/src/System.Runtime.Extensions/tests/System/EnvironmentTests.cs
+++ b/src/System.Runtime.Extensions/tests/System/EnvironmentTests.cs
@@ -98,7 +98,7 @@ namespace System.Tests
}
[Fact]
- [PlatformSpecific(TestPlatforms.AnyUnix)]
+ [PlatformSpecific(TestPlatforms.AnyUnix)] // Tests OS-specific environment
public void Is64BitOperatingSystem_Unix_TrueIff64BitProcess()
{
Assert.Equal(Environment.Is64BitProcess, Environment.Is64BitOperatingSystem);
@@ -161,7 +161,7 @@ namespace System.Tests
}
[Fact]
- [PlatformSpecific(TestPlatforms.AnyUnix)]
+ [PlatformSpecific(TestPlatforms.AnyUnix)] // Tests OS-specific environment
public void UserDomainName_Unix_MatchesMachineName()
{
Assert.Equal(Environment.MachineName, Environment.UserDomainName);
@@ -198,7 +198,7 @@ namespace System.Tests
}
[Fact]
- [PlatformSpecific(TestPlatforms.AnyUnix)]
+ [PlatformSpecific(TestPlatforms.AnyUnix)] // Tests OS-specific environment
public void GetFolderPath_Unix_PersonalIsHomeAndUserProfile()
{
Assert.Equal(Environment.GetEnvironmentVariable("HOME"), Environment.GetFolderPath(Environment.SpecialFolder.Personal));
@@ -213,7 +213,7 @@ namespace System.Tests
}
[Theory]
- [PlatformSpecific(TestPlatforms.AnyUnix)]
+ [PlatformSpecific(TestPlatforms.AnyUnix)] // Tests OS-specific environment
[InlineData(Environment.SpecialFolder.UserProfile, Environment.SpecialFolderOption.None)]
[InlineData(Environment.SpecialFolder.Personal, Environment.SpecialFolderOption.None)]
[InlineData(Environment.SpecialFolder.MyDocuments, Environment.SpecialFolderOption.None)]
@@ -240,7 +240,7 @@ namespace System.Tests
}
[Theory]
- [PlatformSpecific(TestPlatforms.OSX)]
+ [PlatformSpecific(TestPlatforms.OSX)] // Tests OS-specific environment
[InlineData(Environment.SpecialFolder.Favorites, Environment.SpecialFolderOption.DoNotVerify)]
[InlineData(Environment.SpecialFolder.InternetCache, Environment.SpecialFolderOption.DoNotVerify)]
[InlineData(Environment.SpecialFolder.ProgramFiles, Environment.SpecialFolderOption.None)]
@@ -302,7 +302,7 @@ namespace System.Tests
// [InlineData(Environment.SpecialFolder.LocalizedResources)]
[InlineData(Environment.SpecialFolder.SystemX86)]
[InlineData(Environment.SpecialFolder.Windows)]
- [PlatformSpecific(TestPlatforms.Windows)]
+ [PlatformSpecific(TestPlatforms.Windows)] // Tests OS-specific environment
public unsafe void GetFolderPath_Windows(Environment.SpecialFolder folder)
{
string knownFolder = Environment.GetFolderPath(folder);
@@ -316,7 +316,7 @@ namespace System.Tests
}
[Fact]
- [PlatformSpecific(TestPlatforms.AnyUnix)]
+ [PlatformSpecific(TestPlatforms.AnyUnix)] // Uses P/Invokes
public void GetLogicalDrives_Unix_AtLeastOneIsRoot()
{
string[] drives = Environment.GetLogicalDrives();
@@ -327,7 +327,7 @@ namespace System.Tests
}
[Fact]
- [PlatformSpecific(TestPlatforms.Windows)]
+ [PlatformSpecific(TestPlatforms.Windows)] // Uses P/Invokes
public void GetLogicalDrives_Windows_MatchesExpectedLetters()
{
string[] drives = Environment.GetLogicalDrives();
diff --git a/src/System.Runtime.Extensions/tests/System/IO/Path.Combine.cs b/src/System.Runtime.Extensions/tests/System/IO/Path.Combine.cs
index 91980393c4..2e2cdc2914 100644
--- a/src/System.Runtime.Extensions/tests/System/IO/Path.Combine.cs
+++ b/src/System.Runtime.Extensions/tests/System/IO/Path.Combine.cs
@@ -141,7 +141,7 @@ namespace System.IO.Tests
}
[Fact]
- [PlatformSpecific(TestPlatforms.Windows)]
+ [PlatformSpecific(TestPlatforms.Windows)] // Tests Windows-specific invalid paths
public static void ContainsInvalidCharWithoutRootedAfterArgumentNull_Windows()
{
//any path contains invalid character without rooted after (AE)
@@ -159,7 +159,7 @@ namespace System.IO.Tests
}
[Fact]
- [PlatformSpecific(TestPlatforms.Windows)]
+ [PlatformSpecific(TestPlatforms.Windows)] // Tests Windows-specific invalid paths
public static void ContainsInvalidCharWithRootedAfterArgumentNull_Windows()
{
//any path contains invalid character with rooted after (AE)
diff --git a/src/System.Runtime.Extensions/tests/System/IO/Path.GetRelativePath.cs b/src/System.Runtime.Extensions/tests/System/IO/Path.GetRelativePath.cs
index 5f8107c584..36a03d6bfc 100644
--- a/src/System.Runtime.Extensions/tests/System/IO/Path.GetRelativePath.cs
+++ b/src/System.Runtime.Extensions/tests/System/IO/Path.GetRelativePath.cs
@@ -29,7 +29,7 @@ namespace System.IO.Tests
[InlineData(@"C:\a", @"C:\ab", @"..\ab")]
[InlineData(@"C:\", @"\\LOCALHOST\Share\b", @"\\LOCALHOST\Share\b")]
[InlineData(@"\\LOCALHOST\Share\a", @"\\LOCALHOST\Share\b", @"..\b")]
- [PlatformSpecific(TestPlatforms.Windows)]
+ [PlatformSpecific(TestPlatforms.Windows)] // Tests Windows-specific paths
public static void GetRelativePath_Windows(string relativeTo, string path, string expected)
{
string result = Path.GetRelativePath(relativeTo, path);
@@ -56,7 +56,7 @@ namespace System.IO.Tests
[InlineData(@"/a/", @"/a/b", @"b")]
[InlineData(@"/ab", @"/a", @"../a")]
[InlineData(@"/a", @"/ab", @"../ab")]
- [PlatformSpecific(TestPlatforms.AnyUnix)]
+ [PlatformSpecific(TestPlatforms.AnyUnix)] // Tests Unix-specific paths
public static void GetRelativePath_AnyUnix(string relativeTo, string path, string expected)
{
string result = Path.GetRelativePath(relativeTo, path);
@@ -72,7 +72,7 @@ namespace System.IO.Tests
[InlineData(@"/a", @"/A/", @"../A/")]
[InlineData(@"/a/", @"/A", @"../A")]
[InlineData(@"/a/", @"/A/b", @"../A/b")]
- [PlatformSpecific(TestPlatforms.Linux)]
+ [PlatformSpecific(TestPlatforms.Linux)] // Tests Linux relative path behavior
public static void GetRelativePath_Linux(string relativeTo, string path, string expected)
{
string result = Path.GetRelativePath(relativeTo, path);
@@ -88,7 +88,7 @@ namespace System.IO.Tests
[InlineData(@"/a", @"/A/", @"../A/")]
[InlineData(@"/a/", @"/A", @"../A")]
[InlineData(@"/a/", @"/A/b", @"../A/b")]
- [PlatformSpecific(TestPlatforms.FreeBSD)]
+ [PlatformSpecific(TestPlatforms.FreeBSD)] // Tests FreeBSD relative path behavior
public static void GetRelativePath_FreeBSD(string relativeTo, string path, string expected)
{
string result = Path.GetRelativePath(relativeTo, path);
@@ -104,7 +104,7 @@ namespace System.IO.Tests
[InlineData(@"/a", @"/A/", @"../A/")]
[InlineData(@"/a/", @"/A", @"../A")]
[InlineData(@"/a/", @"/A/b", @"../A/b")]
- [PlatformSpecific(TestPlatforms.NetBSD)]
+ [PlatformSpecific(TestPlatforms.NetBSD)] // Tests NetBSD relative path behavior
public static void GetRelativePath_NetBSD(string relativeTo, string path, string expected)
{
string result = Path.GetRelativePath(relativeTo, path);
@@ -120,7 +120,7 @@ namespace System.IO.Tests
[InlineData(@"/a", @"/A/", @".")]
[InlineData(@"/a/", @"/A", @".")]
[InlineData(@"/a/", @"/A/b", @"b")]
- [PlatformSpecific(TestPlatforms.OSX)]
+ [PlatformSpecific(TestPlatforms.OSX)] // Tests OSX relative path behavior
public static void GetRelativePath_Mac(string relativeTo, string path, string expected)
{
string result = Path.GetRelativePath(relativeTo, path);
diff --git a/src/System.Runtime.Extensions/tests/System/IO/PathTests.cs b/src/System.Runtime.Extensions/tests/System/IO/PathTests.cs
index 458f058909..54263aec1b 100644
--- a/src/System.Runtime.Extensions/tests/System/IO/PathTests.cs
+++ b/src/System.Runtime.Extensions/tests/System/IO/PathTests.cs
@@ -55,7 +55,7 @@ namespace System.IO.Tests
[InlineData(@"..\..\files.txt", @"..\..")]
[InlineData(@"C:\", null)]
[InlineData(@"C:", null)]
- [PlatformSpecific(TestPlatforms.Windows)]
+ [PlatformSpecific(TestPlatforms.Windows)] // Tests Windows-specific paths
public static void GetDirectoryName_Windows(string path, string expected)
{
Assert.Equal(expected, Path.GetDirectoryName(path));
@@ -68,7 +68,7 @@ namespace System.IO.Tests
[InlineData(@"dir/baz/bar", @"dir/baz")]
[InlineData(@"../../files.txt", @"../..")]
[InlineData(@"/", null)]
- [PlatformSpecific(TestPlatforms.AnyUnix)]
+ [PlatformSpecific(TestPlatforms.AnyUnix)] // Tests Unix-specific paths
public static void GetDirectoryName_Unix(string path, string expected)
{
Assert.Equal(expected, Path.GetDirectoryName(path));
@@ -82,7 +82,7 @@ namespace System.IO.Tests
Assert.Equal(null, Path.GetDirectoryName(Path.GetPathRoot(curDir)));
}
- [PlatformSpecific(TestPlatforms.AnyUnix)]
+ [PlatformSpecific(TestPlatforms.AnyUnix)] // Checks Unix-specific special characters in directory path
[Fact]
public static void GetDirectoryName_ControlCharacters_Unix()
{
@@ -110,7 +110,7 @@ namespace System.IO.Tests
Assert.Equal(!string.IsNullOrEmpty(expected), Path.HasExtension(path));
}
- [PlatformSpecific(TestPlatforms.AnyUnix)]
+ [PlatformSpecific(TestPlatforms.AnyUnix)] // Checks file extension behavior on Unix
[Theory]
[InlineData("file.e xe", ".e xe")]
[InlineData("file. ", ". ")]
@@ -143,7 +143,7 @@ namespace System.IO.Tests
Assert.Equal(expected, Path.GetFileName(path));
}
- [PlatformSpecific(TestPlatforms.AnyUnix)]
+ [PlatformSpecific(TestPlatforms.AnyUnix)] // Tests Unix-specific valid file names
[Fact]
public static void GetFileName_Unix()
{
@@ -185,7 +185,7 @@ namespace System.IO.Tests
Assert.False(Path.IsPathRooted("file.exe"));
}
- [PlatformSpecific(TestPlatforms.Windows)]
+ [PlatformSpecific(TestPlatforms.Windows)] // Tests UNC
[Theory]
[InlineData(@"\\test\unc\path\to\something", @"\\test\unc")]
[InlineData(@"\\a\b\c\d\e", @"\\a\b")]
@@ -203,7 +203,7 @@ namespace System.IO.Tests
Assert.Equal(expected, Path.GetPathRoot(value));
}
- [PlatformSpecific(TestPlatforms.Windows)]
+ [PlatformSpecific(TestPlatforms.Windows)] // Tests Windows-specific path convention
[Theory]
[InlineData(@"C:", @"C:")]
[InlineData(@"C:\", @"C:\")]
@@ -218,7 +218,7 @@ namespace System.IO.Tests
Assert.Equal(expected, Path.GetPathRoot(value));
}
- [PlatformSpecific(TestPlatforms.AnyUnix)]
+ [PlatformSpecific(TestPlatforms.AnyUnix)] // Tests Unix-specific path convention
[Fact]
public static void GetPathRoot_Unix()
{
@@ -304,7 +304,7 @@ namespace System.IO.Tests
Assert.True(Directory.Exists(tmpPath));
}
- [PlatformSpecific(TestPlatforms.Windows)]
+ [PlatformSpecific(TestPlatforms.Windows)] // Sets environment vars with Windows-specific paths
[Theory]
[InlineData(@"C:\Users\someuser\AppData\Local\Temp\", @"C:\Users\someuser\AppData\Local\Temp")]
[InlineData(@"C:\Users\someuser\AppData\Local\Temp\", @"C:\Users\someuser\AppData\Local\Temp\")]
@@ -316,7 +316,7 @@ namespace System.IO.Tests
GetTempPath_SetEnvVar("TMP", expected, newTempPath);
}
- [PlatformSpecific(TestPlatforms.AnyUnix)]
+ [PlatformSpecific(TestPlatforms.AnyUnix)] // Sets environment vars with Unix-specific paths
[Theory]
[InlineData("/tmp/", "/tmp")]
[InlineData("/tmp/", "/tmp/")]
@@ -413,7 +413,7 @@ namespace System.IO.Tests
Assert.Equal(expected, Path.GetFullPath(path));
}
- [PlatformSpecific(TestPlatforms.AnyUnix)]
+ [PlatformSpecific(TestPlatforms.AnyUnix)] // Tests whitespaces in paths on Unix
[Fact]
public static void GetFullPath_Unix_Whitespace()
{
@@ -423,7 +423,7 @@ namespace System.IO.Tests
Assert.Equal(Path.Combine(curDir, "\r\n"), Path.GetFullPath("\r\n"));
}
- [PlatformSpecific(TestPlatforms.AnyUnix)]
+ [PlatformSpecific(TestPlatforms.AnyUnix)] // Tests URIs as valid file names
[Theory]
[InlineData("http://www.microsoft.com")]
[InlineData("file://somefile")]
@@ -435,7 +435,7 @@ namespace System.IO.Tests
Path.GetFullPath(uriAsFileName));
}
- [PlatformSpecific(TestPlatforms.Windows)]
+ [PlatformSpecific(TestPlatforms.Windows)] // Checks normalized long path (> MaxPath) on Windows
[Fact]
public static void GetFullPath_Windows_NormalizedLongPathTooLong()
{
@@ -452,7 +452,7 @@ namespace System.IO.Tests
Assert.NotNull(Path.GetFullPath(longPath.ToString()));
}
- [PlatformSpecific(TestPlatforms.Windows)]
+ [PlatformSpecific(TestPlatforms.Windows)] // Tests Windows-specific invalid paths
[Fact]
public static void GetFullPath_Windows_AlternateDataStreamsNotSupported()
{
@@ -461,7 +461,7 @@ namespace System.IO.Tests
Assert.Throws<NotSupportedException>(() => Path.GetFullPath(@"C:\some\bad:path"));
}
- [PlatformSpecific(TestPlatforms.Windows)]
+ [PlatformSpecific(TestPlatforms.Windows)] // Tests Windows-specific invalid paths
[Fact]
public static void GetFullPath_Windows_URIFormatNotSupported()
{
@@ -470,7 +470,7 @@ namespace System.IO.Tests
Assert.Throws<NotSupportedException>(() => Path.GetFullPath("file://www.microsoft.com"));
}
- [PlatformSpecific(TestPlatforms.Windows)]
+ [PlatformSpecific(TestPlatforms.Windows)] // Tests Windows-specific invalid paths
[Theory]
[InlineData(@"bad::$DATA")]
[InlineData(@"C :")]
@@ -481,7 +481,7 @@ namespace System.IO.Tests
Assert.Throws<NotSupportedException>(() => Path.GetFullPath(path));
}
- [PlatformSpecific(TestPlatforms.Windows)]
+ [PlatformSpecific(TestPlatforms.Windows)] // Tests legitimate Windows paths that are now allowed
[Theory]
[InlineData(@"C:...")]
[InlineData(@"C:...\somedir")]
@@ -495,7 +495,7 @@ namespace System.IO.Tests
Path.GetFullPath(path);
}
- [PlatformSpecific(TestPlatforms.Windows)]
+ [PlatformSpecific(TestPlatforms.Windows)] // Tests MaxPathNotTooLong on Windows
[Fact]
public static void GetFullPath_Windows_MaxPathNotTooLong()
{
@@ -503,14 +503,14 @@ namespace System.IO.Tests
Path.GetFullPath(@"C:\" + new string('a', 255) + @"\");
}
- [PlatformSpecific(TestPlatforms.Windows)]
+ [PlatformSpecific(TestPlatforms.Windows)] // Tests PathTooLong on Windows
[Fact]
public static void GetFullPath_Windows_PathTooLong()
{
Assert.Throws<PathTooLongException>(() => Path.GetFullPath(@"C:\" + new string('a', short.MaxValue) + @"\"));
}
- [PlatformSpecific(TestPlatforms.Windows)]
+ [PlatformSpecific(TestPlatforms.Windows)] // Tests Windows-specific paths
[Theory]
[InlineData(@"C:\", @"C:\")]
[InlineData(@"C:\.", @"C:\")]
@@ -523,7 +523,7 @@ namespace System.IO.Tests
Assert.Equal(Path.GetFullPath(path), expected);
}
- [PlatformSpecific(TestPlatforms.Windows)]
+ [PlatformSpecific(TestPlatforms.Windows)] // Tests legitimate strage windows paths that are now allowed
[Fact]
public static void GetFullPath_Windows_StrangeButLegalPaths()
{
@@ -542,7 +542,7 @@ namespace System.IO.Tests
Path.GetFullPath(curDir + Path.DirectorySeparatorChar + ".. " + Path.DirectorySeparatorChar));
}
- [PlatformSpecific(TestPlatforms.Windows)]
+ [PlatformSpecific(TestPlatforms.Windows)] // Tests Windows-specific paths
[Theory]
[InlineData(@"\\?\C:\ ")]
[InlineData(@"\\?\C:\ \ ")]
@@ -599,7 +599,7 @@ namespace System.IO.Tests
}
}
- [PlatformSpecific(TestPlatforms.Windows)]
+ [PlatformSpecific(TestPlatforms.Windows)] // Tests valid paths based on UNC
[Theory]
// https://github.com/dotnet/corefx/issues/11965
[InlineData(@"\\LOCALHOST\share\test.txt.~SS", @"\\LOCALHOST\share\test.txt.~SS")]
@@ -630,7 +630,7 @@ namespace System.IO.Tests
Assert.Equal(expected, Path.GetFullPath(input));
}
- [PlatformSpecific(TestPlatforms.Windows)]
+ [PlatformSpecific(TestPlatforms.Windows)] // Tests invalid paths based on UNC
[Theory]
[InlineData(@"\\")]
[InlineData(@"\\LOCALHOST")]
@@ -642,7 +642,7 @@ namespace System.IO.Tests
Assert.Throws<ArgumentException>(() => Path.GetFullPath(invalidPath));
}
- [PlatformSpecific(TestPlatforms.Windows)]
+ [PlatformSpecific(TestPlatforms.Windows)] // Uses P/Invokes to get short path name
[ConditionalFact(nameof(PlatformDetection) + "." + nameof(PlatformDetection.IsNotWindowsNanoServer))]
public static void GetFullPath_Windows_83Paths()
{
@@ -687,7 +687,7 @@ namespace System.IO.Tests
}
}
- [PlatformSpecific(TestPlatforms.Windows)]
+ [PlatformSpecific(TestPlatforms.Windows)] // Tests Windows-specific invalid paths
[Theory]
[InlineData('*')]
[InlineData('?')]