Imported Upstream version 6.0.0.172

Former-commit-id: f3cc9b82f3e5bd8f0fd3ebc098f789556b44e9cd
This commit is contained in:
Xamarin Public Jenkins (auto-signing)
2019-04-12 14:10:50 +00:00
parent 8016999e4d
commit 64ac736ec5
32155 changed files with 3981439 additions and 75368 deletions

View File

@@ -1 +1 @@
d5529557985b2dfc14eb9efc721ef19175f2d627
14eee263c76aac73a53611a62479a25339ce5c56

View File

@@ -35,6 +35,7 @@ namespace Mono
MONO_NATIVE_PLATFORM_TYPE_MACOS = 1,
MONO_NATIVE_PLATFORM_TYPE_IOS = 2,
MONO_NATIVE_PLATFORM_TYPE_LINUX = 3,
MONO_NATIVE_PLATFORM_TYPE_AIX = 4,
MONO_NATIVE_PLATFORM_TYPE_IPHONE = 0x100,
MONO_NATIVE_PLATFORM_TYPE_TV = 0x200,

View File

@@ -91,6 +91,8 @@ namespace MonoTests.System.Diagnostics
/// Tests whether getting method associated with frame works.
/// </summary>
[Test]
[Category("StackWalks")]
[Category("NotWasm")]
public void TestGetMethod ()
{
Assert.IsTrue ((frame1.GetMethod () != null), "Method not null (1)");
@@ -182,7 +184,7 @@ namespace MonoTests.System.Diagnostics
frame1.GetFileLineNumber (),
"Line number (1)");
Assert.AreEqual (136,
Assert.AreEqual (138,
frame2.GetFileLineNumber (),
"Line number (2)");
@@ -215,6 +217,8 @@ namespace MonoTests.System.Diagnostics
/// Tests whether getting method associated with frame works.
/// </summary>
[Test]
[Category("StackWalks")]
[Category("NotWasm")]
public void TestGetMethod ()
{
Assert.IsNotNull (frame1.GetMethod (),
@@ -322,7 +326,7 @@ namespace MonoTests.System.Diagnostics
frame1.GetFileLineNumber (),
"Line number (1)");
Assert.AreEqual (272,
Assert.AreEqual (276,
frame2.GetFileLineNumber (),
"Line number (2)");
}
@@ -347,6 +351,7 @@ namespace MonoTests.System.Diagnostics
/// Test whether GetFrames contains the frames for nested exceptions
/// </summary>
[Test]
[Category("StackWalks")]
public void GetFramesAndNestedExc ()
{
try
@@ -425,6 +430,8 @@ namespace MonoTests.System.Diagnostics
/// Tests whether getting method associated with frame works.
/// </summary>
[Test]
[Category("StackWalks")]
[Category("NotWasm")]
public void TestGetMethod ()
{
Assert.IsTrue ((frame1.GetMethod () != null), "Method not null (1)");

View File

@@ -825,6 +825,17 @@ public class CalendarTest {
}
}
[Test]
public void TestJapaneseCalendarDateParsing ()
{
CultureInfo ciJapanese = new CultureInfo ("ja-JP") { DateTimeFormat = { Calendar = new JapaneseCalendar () } };
DateTime dt = new DateTime (1970, 1, 1);
string eraName = dt.ToString ("gg", ciJapanese);
Assert.AreEqual (new DateTime (1995, 1, 1), DateTime.Parse (eraName + " 70/1/1 0:00:00", ciJapanese));
}
// TODO: more tests :-)
} // class CalendarTest

View File

@@ -283,6 +283,7 @@ namespace MonoTests.System.Globalization
}
[Test] // bug #81930
[Category ("NotWasm")]
public void IsReadOnly ()
{
CultureInfo ci;
@@ -504,6 +505,7 @@ namespace MonoTests.System.Globalization
}
[Test]
[Category ("NotWasm")]
public void UseUserOverride_CurrentCulture ()
{
CultureInfo ci = CultureInfo.CurrentCulture;
@@ -515,6 +517,7 @@ namespace MonoTests.System.Globalization
}
[Test]
[Category ("NotWasm")]
public void UseUserOverride_CurrentUICulture ()
{
CultureInfo ci = CultureInfo.CurrentCulture;
@@ -757,6 +760,7 @@ namespace MonoTests.System.Globalization
}
[Test]
[Category ("MultiThreaded")]
public void FlowCultureInfoFromParentThreadSinceNet46 ()
{
if (SynchronizationContext.Current != null) {

View File

@@ -142,6 +142,28 @@ namespace MonoTests.System.Globalization
DateTime dt2 = DateTime.Parse (s, ci);
Assert.AreEqual (dt.Month, dt2.Month);
}
[Test]
public void TestFirstYearOfJapaneseEra ()
{
DateTimeFormatInfo jpnFormat = new CultureInfo ("ja-JP").DateTimeFormat;
jpnFormat.Calendar = new JapaneseCalendar ();
string pattern = "gg yyyy'\u5E74' MM'\u6708' dd'\u65E5'"; // "gg yyyy'年' MM'月' dd'日'"
DateTime dt = new DateTime (1989, 01, 08); // Start of Heisei Era
string formattedDateWithGannen = "\u5E73\u6210 \u5143\u5E74 01\u6708 08\u65E5"; // 平成 元年 01月 08日
string formattedDate = dt.ToString (pattern, jpnFormat);
Assert.IsTrue (DateTime.TryParseExact (formattedDate, pattern, jpnFormat, DateTimeStyles.None, out DateTime parsedDate));
Assert.AreEqual (dt, parsedDate);
// If the formatting with Gan-nen is supported, then parsing should succeed. otherwise parsing should fail.
Assert.IsTrue (formattedDate.IndexOf ("\u5143" /* 元 */, StringComparison.Ordinal) >= 0 ==
DateTime.TryParseExact (formattedDateWithGannen, pattern, jpnFormat, DateTimeStyles.None, out parsedDate),
$"Parsing '{formattedDateWithGannen}' result should match if '{formattedDate}' has Gan-nen symbol"
);
}
}
}

View File

@@ -1088,8 +1088,6 @@ namespace MonoTests.System.IO.IsolatedStorageTest {
isf.CreateDirectory ("dir1/test/test2b");
dirs = isf.GetDirectoryNames ("dir1/test/*");
Assert.AreEqual (dirs.Length, 2, "3a");
Assert.AreEqual (dirs [0], "test2a", "3b");
Assert.AreEqual (dirs [1], "test2b", "3c");
}
finally {
isf.DeleteDirectory ("dir1/test/test2a");

View File

@@ -235,8 +235,6 @@ namespace MonoTests.System.IO.IsolatedStorageTest {
isf.CreateDirectory ("dir1/test/test2b");
dirs = isf.GetDirectoryNames ("dir1/test/*");
Assert.AreEqual (2, dirs.Length, "3a");
Assert.AreEqual ("test2a", dirs [0], "3b");
Assert.AreEqual ("test2b", dirs [1], "3c");
} finally {
isf.DeleteDirectory ("dir1/test/test2a");
isf.DeleteDirectory ("dir1/test/test2b");

View File

@@ -470,7 +470,7 @@ namespace MonoTests.System.IO
File.Create (path + DSC + "filetest").Close ();
Assert.AreEqual (2, info.GetDirectories ().Length, "#2");
Directory.Delete (path + DSC + 2);
Directory.Delete (path + DSC + "2");
Assert.AreEqual (1, info.GetDirectories ().Length, "#3");
} finally {
DeleteDir (path);
@@ -888,6 +888,7 @@ namespace MonoTests.System.IO
string path2 = TempFolder + DSC + "DIT.MoveToUpdateProperties2.Test";
string path3 = path2 + DSC + "DIT.MoveToUpdateProperties3.Test";
DeleteDir (path);
DeleteDir (path2);
Directory.CreateDirectory (path);
Directory.CreateDirectory (path2);
@@ -901,7 +902,6 @@ namespace MonoTests.System.IO
info.MoveTo (path3);
Assert.IsTrue (Directory.Exists(info.FullName));
Assert.AreEqual (path3, info.FullName);
Assert.AreEqual ("DIT.MoveToUpdateProperties3.Test", info.Name);
Assert.AreEqual (path2, info.Parent.FullName);
Assert.AreEqual (path3, info.ToString ());
@@ -1064,15 +1064,14 @@ namespace MonoTests.System.IO
public void EnumerateFileSystemInfosTest ()
{
var dirInfo = new DirectoryInfo (TempFolder);
dirInfo.CreateSubdirectory ("1").CreateSubdirectory ("a");
dirInfo.CreateSubdirectory ("2").CreateSubdirectory ("b");
dirInfo.CreateSubdirectory ("one").CreateSubdirectory ("a");
dirInfo.CreateSubdirectory ("two").CreateSubdirectory ("b");
var l = new List<string> ();
foreach (var info in dirInfo.EnumerateFileSystemInfos ("*", SearchOption.AllDirectories))
l.Add (info.Name);
l.Sort ();
Assert.AreEqual ("1,2,a,b", string.Join (",", l), "#1");
}
#if !MOBILE
@@ -1086,7 +1085,7 @@ namespace MonoTests.System.IO
si = new SerializationInfo (typeof (DirectoryInfo), new FormatterConverter ());
info.GetObjectData (si, new StreamingContext ());
Assert.AreEqual (2, si.MemberCount, "#A1");
Assert.AreEqual (3, si.MemberCount, "#A1");
Assert.AreEqual ("Test", si.GetString ("OriginalPath"), "#A2");
Assert.AreEqual (Path.Combine (Directory.GetCurrentDirectory (), "Test"), si.GetString ("FullPath"), "#A3");
@@ -1094,7 +1093,7 @@ namespace MonoTests.System.IO
si = new SerializationInfo (typeof (DirectoryInfo), new FormatterConverter ());
info.GetObjectData (si, new StreamingContext ());
Assert.AreEqual (2, si.MemberCount, "#B1");
Assert.AreEqual (3, si.MemberCount, "#B1");
Assert.AreEqual (TempFolder, si.GetString ("OriginalPath"), "#B2");
Assert.AreEqual (TempFolder, si.GetString ("FullPath"), "#B3");
}

View File

@@ -150,7 +150,6 @@ public class DirectoryTest
Assert.AreEqual (typeof (ArgumentException), ex.GetType (), "#2");
Assert.IsNull (ex.InnerException, "#3");
Assert.IsNotNull (ex.Message, "#4");
Assert.IsNull (ex.ParamName, "#5");
}
}
@@ -237,7 +236,7 @@ public class DirectoryTest
path = Path.Combine (path, "..");
var res = Directory.CreateDirectory (path);
Assert.AreEqual ("relativepath", res.ToString (), "#1");
Assert.AreEqual (Path.GetFullPath (path), res.ToString (), "#1");
Assert.IsTrue (Directory.Exists (Path.Combine (TempFolder, "relativepath")), "#2");
}
@@ -348,9 +347,6 @@ public class DirectoryTest
Assert.Fail ("#1");
}
catch (IOException ex) {
Assert.AreEqual (typeof (IOException), ex.GetType (), "#2");
// exception message DOES NOT contains the path
Assert.IsFalse (ex.Message.IndexOf (path) >= 0, "#3");
Assert.IsNull (ex.InnerException, "#4");
}
finally {
@@ -1003,6 +999,7 @@ public class DirectoryTest
}
[Test]
[Category ("NotWasm")]
public void LastAccessTime ()
{
string path = TempFolder + DSC + "DirectoryTest.AccessTime.1";
@@ -1113,7 +1110,7 @@ public class DirectoryTest
}
[Test]
[ExpectedException(typeof(FileNotFoundException))]
[ExpectedException()]
public void SetLastWriteTimeException3 ()
{
DateTime time = new DateTime (2003, 4, 6, 6, 4, 2);
@@ -1177,7 +1174,7 @@ public class DirectoryTest
}
[Test]
[ExpectedException(typeof(FileNotFoundException))]
[ExpectedException()]
public void SetLastWriteTimeUtcException3 ()
{
DateTime time = new DateTime (2003, 4, 6, 6, 4, 2);
@@ -1239,7 +1236,7 @@ public class DirectoryTest
}
[Test]
[ExpectedException(typeof(FileNotFoundException))]
[ExpectedException()]
public void SetLastAccessTimeException3 ()
{
DateTime time = new DateTime (2003, 4, 6, 6, 4, 2);
@@ -1302,7 +1299,7 @@ public class DirectoryTest
}
[Test]
[ExpectedException(typeof(FileNotFoundException))]
[ExpectedException()]
public void SetLastAccessTimeUtcException3 ()
{
DateTime time = new DateTime (2003, 4, 6, 6, 4, 2);
@@ -1364,7 +1361,7 @@ public class DirectoryTest
}
[Test]
[ExpectedException(typeof(FileNotFoundException))]
[ExpectedException()]
public void SetCreationTimeException3 ()
{
DateTime time = new DateTime (2003, 4, 6, 6, 4, 2);
@@ -1429,7 +1426,7 @@ public class DirectoryTest
}
[Test]
[ExpectedException(typeof(FileNotFoundException))]
[ExpectedException()]
public void SetCreationTimeUtcException3 ()
{
DateTime time = new DateTime (2003, 4, 6, 6, 4, 2);
@@ -1545,6 +1542,7 @@ public class DirectoryTest
}
[Test]
[Category ("NotWasm")]
public void GetFiles ()
{
string path = TempFolder;
@@ -1725,6 +1723,11 @@ public class DirectoryTest
Directory.SetCurrentDirectory (" ");
}
[Test] // https://github.com/mono/mono/issues/13030
public void GetLogicalDrivesNotEmpty ()
{
CollectionAssert.IsNotEmpty (Directory.GetLogicalDrives ());
}
[Test]
public void GetNoFiles () // Bug 58875. This throwed an exception on windows.

View File

@@ -65,6 +65,7 @@ namespace MonoTests.System.IO
}
[Test]
[Category ("NotWasm")]
public void GetDrivesValidInfo ()
{
var drives = DriveInfo.GetDrives ();

View File

@@ -348,7 +348,6 @@ namespace MonoTests.System.IO
} catch (ArgumentException ex) {
// The path is not of a legal form
Assert.AreEqual (typeof (ArgumentException), ex.GetType (), "#2");
Assert.IsNull (ex.InnerException, "#3");
Assert.IsNotNull (ex.Message, "#4");
Assert.IsNull (ex.ParamName, "#5");
}
@@ -618,7 +617,6 @@ namespace MonoTests.System.IO
Assert.Fail ("#1");
} catch (UnauthorizedAccessException ex) {
Assert.AreEqual (typeof (UnauthorizedAccessException), ex.GetType (), "#2");
Assert.IsNull (ex.InnerException, "#3");
Assert.IsNotNull (ex.Message, "#4");
}
}
@@ -682,6 +680,7 @@ namespace MonoTests.System.IO
}
[Test]
[Category ("NotWasm")]
public void MoveTo_DestFileName_AlreadyExists ()
{
string sourceFile = TempFolder + DSC + "FIT.MoveTo.Source.Test";
@@ -700,7 +699,6 @@ namespace MonoTests.System.IO
Assert.IsNull (ex.InnerException, "#A3");
Assert.IsNotNull (ex.Message, "#A4");
Assert.IsFalse (ex.Message.IndexOf (sourceFile) != -1, "#A5");
Assert.IsFalse (ex.Message.IndexOf (TempFolder) != -1, "#A6");
} finally {
DeleteFile (sourceFile);
}
@@ -719,7 +717,6 @@ namespace MonoTests.System.IO
Assert.IsNull (ex.InnerException, "#B3");
Assert.IsNotNull (ex.Message, "#B4");
Assert.IsFalse (ex.Message.IndexOf (sourceFile) != -1, "#B5");
Assert.IsFalse (ex.Message.IndexOf (destFile) != -1, "#B6");
} finally {
DeleteFile (sourceFile);
DeleteFile (destFile);
@@ -739,7 +736,6 @@ namespace MonoTests.System.IO
Assert.IsNull (ex.InnerException, "#C3");
Assert.IsNotNull (ex.Message, "#C4");
Assert.IsFalse (ex.Message.IndexOf (sourceFile) != -1, "#C5");
Assert.IsFalse (ex.Message.IndexOf (destFile) != -1, "#C6");
} finally {
DeleteFile (sourceFile);
DeleteDirectory (destFile);
@@ -747,6 +743,7 @@ namespace MonoTests.System.IO
}
[Test]
[Category ("NotWasm")]
public void MoveTo_DestFileName_DirectoryDoesNotExist ()
{
string sourceFile = TempFolder + Path.DirectorySeparatorChar + "foo";
@@ -856,7 +853,6 @@ namespace MonoTests.System.IO
} catch (FileNotFoundException ex) {
// Unable to find the specified file
Assert.AreEqual (typeof (FileNotFoundException), ex.GetType (), "#2");
Assert.IsNull (ex.FileName, "#2");
Assert.IsNull (ex.InnerException, "#3");
Assert.IsNotNull (ex.Message, "#4");
}
@@ -1069,34 +1065,6 @@ namespace MonoTests.System.IO
}
}
[Test]
public void Replace1_DestFileName_IsReadOnly ()
{
string path1 = TempFolder + DSC + "FIT.Replace.Source.Test";
string path2 = TempFolder + DSC + "FIT.Replace.Dest.Test";
DeleteFile (path1);
DeleteFile (path2);
try {
try {
File.Create (path1).Close ();
File.Create (path2).Close ();
File.SetAttributes (path2, FileAttributes.ReadOnly);
FileInfo info = new FileInfo (path1);
info.Replace (path2, null);
Assert.Fail ("#1");
} catch (UnauthorizedAccessException ex) {
Assert.AreEqual (typeof (UnauthorizedAccessException), ex.GetType (), "#2");
Assert.IsNull (ex.InnerException, "#3");
Assert.IsNotNull (ex.Message, "#4");
}
} finally {
File.SetAttributes (path2, FileAttributes.Normal);
DeleteFile (path1);
DeleteFile (path2);
}
}
[Test]
public void Replace1_Source_FileNotFound ()
{
@@ -1333,7 +1301,7 @@ namespace MonoTests.System.IO
si = new SerializationInfo (typeof (FileInfo), new FormatterConverter ());
info.GetObjectData (si, new StreamingContext ());
Assert.AreEqual (2, si.MemberCount, "#A1");
Assert.AreEqual (3, si.MemberCount, "#A1");
Assert.AreEqual ("Test", si.GetString ("OriginalPath"), "#A2");
Assert.AreEqual (Path.Combine (Directory.GetCurrentDirectory (), "Test"), si.GetString ("FullPath"), "#A3");
@@ -1341,7 +1309,7 @@ namespace MonoTests.System.IO
si = new SerializationInfo (typeof (FileInfo), new FormatterConverter ());
info.GetObjectData (si, new StreamingContext ());
Assert.AreEqual (2, si.MemberCount, "#B1");
Assert.AreEqual (3, si.MemberCount, "#B1");
Assert.AreEqual (TempFolder, si.GetString ("OriginalPath"), "#B2");
Assert.AreEqual (TempFolder, si.GetString ("FullPath"), "#B3");
}

View File

@@ -164,6 +164,7 @@ namespace MonoTests.System.IO
}
[Test]
[Category ("NotOnMac")]
public void CreationTimeNoFileOrDirectory ()
{
string path = TempFolder + DSC + "FSIT.CreationTimeNoFile.Test";
@@ -213,6 +214,7 @@ namespace MonoTests.System.IO
}
[Test]
[Category ("NotOnMac")]
public void DefaultLastAccessTime ()
{
string path = TempFolder + DSC + "FSIT.DefaultLastAccessTime.Test";
@@ -235,6 +237,7 @@ namespace MonoTests.System.IO
}
[Test]
[Category ("NotWasm")]
public void LastAccessTime ()
{
string path = TempFolder + DSC + "FSIT.LastAccessTime.Test";
@@ -277,6 +280,7 @@ namespace MonoTests.System.IO
}
[Test]
[Category ("NotOnMac")]
public void DefaultLastWriteTime ()
{
string path = TempFolder + DSC + "FSIT.DefaultLastWriteTime.Test";
@@ -352,8 +356,7 @@ namespace MonoTests.System.IO
typeof (FileSystemInfo), new FormatterConverter ());
info.GetObjectData (si, new StreamingContext ());
Assert.AreEqual (2, si.MemberCount, "#1");
Assert.AreEqual ("FSIT.Serialization.Test", si.GetString ("OriginalPath"), "#2");
Assert.AreEqual (3, si.MemberCount, "#1");
Assert.AreEqual (path, si.GetString ("FullPath"), "#3");
} finally {
DeleteDir (path);

View File

@@ -155,8 +155,12 @@ namespace MonoTests.System.IO
static bool RunningAsRoot // FIXME?
{
get {
#if WASM
return false;
#else
//return RunningOnUnix && System.Security.WindowsIdentity.GetCurrentToken () == IntPtr.Zero;
return RunningOnUnix && geteuid () == 0;
#endif
}
}
@@ -352,7 +356,6 @@ namespace MonoTests.System.IO
Assert.Fail ("#1");
} catch (FileNotFoundException ex) {
Assert.AreEqual (typeof (FileNotFoundException), ex.GetType (), "#2");
Assert.AreEqual ("doesnotexist", ex.FileName, "#3");
Assert.IsNull (ex.InnerException, "#4");
Assert.IsNotNull (ex.Message, "#5");
}
@@ -483,7 +486,6 @@ namespace MonoTests.System.IO
try {
File.Delete (path);
Assert.Fail ("#1");
} catch (DirectoryNotFoundException ex) {
// Could not find a part of the path "..."
Assert.AreEqual (typeof (DirectoryNotFoundException), ex.GetType (), "#2");
@@ -845,7 +847,6 @@ namespace MonoTests.System.IO
Assert.AreEqual (typeof (DirectoryNotFoundException), ex.GetType (), "#2");
Assert.IsNull (ex.InnerException, "#3");
Assert.IsNotNull (ex.Message, "#4");
Assert.IsFalse (ex.Message.IndexOf (destFile) != -1, "#5");
}
} finally {
DeleteFile (sourceFile);
@@ -853,6 +854,7 @@ namespace MonoTests.System.IO
}
[Test]
[Category("NotWasm")]
public void Move_DestFileName_AlreadyExists ()
{
string sourceFile = tmpFolder + Path.DirectorySeparatorChar + "foo";
@@ -869,7 +871,6 @@ namespace MonoTests.System.IO
Assert.IsNull (ex.InnerException, "#A3");
Assert.IsNotNull (ex.Message, "#A4");
Assert.IsFalse (ex.Message.IndexOf (sourceFile) != -1, "#A5");
Assert.IsFalse (ex.Message.IndexOf (tmpFolder) != -1, "#A6");
} finally {
DeleteFile (sourceFile);
}
@@ -887,7 +888,6 @@ namespace MonoTests.System.IO
Assert.IsNull (ex.InnerException, "#B3");
Assert.IsNotNull (ex.Message, "#B4");
Assert.IsFalse (ex.Message.IndexOf (sourceFile) != -1, "#B5");
Assert.IsFalse (ex.Message.IndexOf (destFile) != -1, "#B6");
} finally {
DeleteFile (sourceFile);
DeleteFile (destFile);
@@ -906,7 +906,6 @@ namespace MonoTests.System.IO
Assert.IsNull (ex.InnerException, "#C3");
Assert.IsNotNull (ex.Message, "#C4");
Assert.IsFalse (ex.Message.IndexOf (sourceFile) != -1, "#C5");
Assert.IsFalse (ex.Message.IndexOf (destFile) != -1, "#C6");
} finally {
DeleteFile (sourceFile);
DeleteDirectory (destFile);
@@ -1193,6 +1192,7 @@ namespace MonoTests.System.IO
}
[Test]
[Category ("NotWasm")]
public void LastAccessTime ()
{
string path = tmpFolder + Path.DirectorySeparatorChar + "lastAccessTime";
@@ -1316,6 +1316,10 @@ namespace MonoTests.System.IO
[Test]
public void LastWriteTimeSubMsCopy ()
{
#if MONOTOUCH
if (Version.TryParse (Environment.GetEnvironmentVariable ("SIMULATOR_RUNTIME_VERSION"), out Version simulatorVersion) && simulatorVersion.Major < 11 && new DriveInfo("/").DriveFormat == "apfs")
Assert.Inconclusive ("This test doesn't work on old iOS Simulator versions running on newer macOS with APFS.");
#endif
string path = tmpFolder + Path.DirectorySeparatorChar + "lastWriteTimeSubMs";
if (File.Exists (path))
File.Delete (path);
@@ -1904,32 +1908,6 @@ namespace MonoTests.System.IO
// }
// }
[Test]
public void SetCreationTime_FileLock ()
{
string path = tmpFolder + Path.DirectorySeparatorChar + "CreationTimeIOException1";
DeleteFile (path);
FileStream stream = null;
try {
stream = File.Create (path);
try {
File.SetCreationTime (path, new DateTime (1000, 12, 12, 11, 59, 59));
Assert.Fail ("#1");
} catch (IOException ex) {
// The process cannot access the file '...'
// because it is being used by another process
Assert.AreEqual (typeof (IOException), ex.GetType (), "#2");
Assert.IsNull (ex.InnerException, "#3");
Assert.IsNotNull (ex.Message, "#4");
Assert.IsTrue (ex.Message.IndexOf (path) != -1, "#5");
}
} finally {
if (stream != null)
stream.Close ();
DeleteFile (path);
}
}
[Test]
public void SetCreationTimeUtc_Path_Null ()
{
@@ -2028,32 +2006,6 @@ namespace MonoTests.System.IO
// }
// }
[Test]
public void SetCreationTimeUtc_FileLock ()
{
string path = tmpFolder + Path.DirectorySeparatorChar + "SetCreationTimeUtcIOException1";
DeleteFile (path);
FileStream stream = null;
try {
stream = File.Create (path);
try {
File.SetCreationTimeUtc (path, new DateTime (1000, 12, 12, 11, 59, 59));
Assert.Fail ("#1");
} catch (IOException ex) {
// The process cannot access the file "..."
// because it is being used by another process
Assert.AreEqual (typeof (IOException), ex.GetType (), "#2");
Assert.IsNull (ex.InnerException, "#3");
Assert.IsNotNull (ex.Message, "#4");
Assert.IsTrue (ex.Message.IndexOf (path) != -1, "#5");
}
} finally {
if (stream != null)
stream.Close ();
DeleteFile (path);
}
}
// SetLastAccessTime and SetLastAccessTimeUtc exceptions
[Test]
@@ -2154,32 +2106,6 @@ namespace MonoTests.System.IO
// }
// }
[Test]
public void SetLastAccessTime_FileLock ()
{
string path = tmpFolder + Path.DirectorySeparatorChar + "LastAccessIOException1";
DeleteFile (path);
FileStream stream = null;
try {
stream = File.Create (path);
try {
File.SetLastAccessTime (path, new DateTime (1000, 12, 12, 11, 59, 59));
Assert.Fail ("#1");
} catch (IOException ex) {
// The process cannot access the file "..."
// because it is being used by another process
Assert.AreEqual (typeof (IOException), ex.GetType (), "#2");
Assert.IsNull (ex.InnerException, "#3");
Assert.IsNotNull (ex.Message, "#4");
Assert.IsTrue (ex.Message.IndexOf (path) != -1, "#5");
}
} finally {
if (stream != null)
stream.Close ();
DeleteFile (path);
}
}
[Test]
public void SetLastAccessTimeUtc_Path_Null ()
{
@@ -2278,32 +2204,6 @@ namespace MonoTests.System.IO
// }
// }
[Test]
public void SetLastAccessTimeUtc_FileLock ()
{
string path = tmpFolder + Path.DirectorySeparatorChar + "SetLastAccessTimeUtcIOException1";
DeleteFile (path);
FileStream stream = null;
try {
stream = File.Create (path);
try {
File.SetLastAccessTimeUtc (path, new DateTime (1000, 12, 12, 11, 59, 59));
Assert.Fail ("#1");
} catch (IOException ex) {
// The process cannot access the file "..."
// because it is being used by another process
Assert.AreEqual (typeof (IOException), ex.GetType (), "#2");
Assert.IsNull (ex.InnerException, "#3");
Assert.IsNotNull (ex.Message, "#4");
Assert.IsTrue (ex.Message.IndexOf (path) != -1, "#5");
}
} finally {
if (stream != null)
stream.Close ();
DeleteFile (path);
}
}
// SetLastWriteTime and SetLastWriteTimeUtc exceptions
[Test]
@@ -2404,32 +2304,6 @@ namespace MonoTests.System.IO
// }
// }
[Test]
public void SetLastWriteTime_FileLock ()
{
string path = tmpFolder + Path.DirectorySeparatorChar + "LastWriteTimeIOException1";
DeleteFile (path);
FileStream stream = null;
try {
stream = File.Create (path);
try {
File.SetLastWriteTime (path, new DateTime (1000, 12, 12, 11, 59, 59));
Assert.Fail ("#1");
} catch (IOException ex) {
// The process cannot access the file '...'
// because it is being used by another process
Assert.AreEqual (typeof (IOException), ex.GetType (), "#2");
Assert.IsNull (ex.InnerException, "#3");
Assert.IsNotNull (ex.Message, "#4");
Assert.IsTrue (ex.Message.IndexOf (path) != -1, "#5");
}
} finally {
if (stream != null)
stream.Close ();
DeleteFile (path);
}
}
[Test]
public void SetLastWriteTimeUtc_Path_Null ()
{
@@ -2528,32 +2402,6 @@ namespace MonoTests.System.IO
// }
// }
[Test]
public void SetLastWriteTimeUtc_FileLock ()
{
string path = tmpFolder + Path.DirectorySeparatorChar + "SetLastWriteTimeUtcIOException1";
DeleteFile (path);
FileStream stream = null;
try {
stream = File.Create (path);
try {
File.SetLastWriteTimeUtc (path, new DateTime (1000, 12, 12, 11, 59, 59));
Assert.Fail ("#1");
} catch (IOException ex) {
// The process cannot access the file '...'
// because it is being used by another process
Assert.AreEqual (typeof (IOException), ex.GetType (), "#2");
Assert.IsNull (ex.InnerException, "#3");
Assert.IsNotNull (ex.Message, "#4");
Assert.IsTrue (ex.Message.IndexOf (path) != -1, "#5");
}
} finally {
if (stream != null)
stream.Close ();
DeleteFile (path);
}
}
[Test]
public void OpenAppend ()
{
@@ -2658,6 +2506,7 @@ namespace MonoTests.System.IO
}
[Test]
[Category("NotWasm")]
public void ReplaceTest ()
{
string tmp = Path.Combine (tmpFolder, "ReplaceTest");
@@ -2740,43 +2589,70 @@ namespace MonoTests.System.IO
}
}
[Test]
public void MoveTest ()
{
MoveTest (FileAccess.Read, FileShare.None, false);
MoveTest (FileAccess.Read, FileShare.Read, false);
MoveTest (FileAccess.Read, FileShare.Write, false);
MoveTest (FileAccess.Read, FileShare.ReadWrite, false);
MoveTest (FileAccess.Read, FileShare.Delete, true);
MoveTest (FileAccess.Read, FileShare.Read | FileShare.Delete, true);
MoveTest (FileAccess.Read, FileShare.Write | FileShare.Delete, true);
MoveTest (FileAccess.Read, FileShare.ReadWrite | FileShare.Delete, true);
MoveTest (FileAccess.Write, FileShare.None, false);
MoveTest (FileAccess.Write, FileShare.Read, false);
MoveTest (FileAccess.Write, FileShare.Write, false);
MoveTest (FileAccess.Write, FileShare.ReadWrite, false);
MoveTest (FileAccess.Write, FileShare.Delete, true);
MoveTest (FileAccess.Write, FileShare.Read | FileShare.Delete, true);
MoveTest (FileAccess.Write, FileShare.Write | FileShare.Delete, true);
MoveTest (FileAccess.Write, FileShare.ReadWrite | FileShare.Delete, true);
MoveTest (FileAccess.ReadWrite, FileShare.None, false);
MoveTest (FileAccess.ReadWrite, FileShare.Read, false);
MoveTest (FileAccess.ReadWrite, FileShare.Write, false);
MoveTest (FileAccess.ReadWrite, FileShare.ReadWrite, false);
MoveTest (FileAccess.ReadWrite, FileShare.Delete, true);
MoveTest (FileAccess.ReadWrite, FileShare.Read | FileShare.Delete, true);
MoveTest (FileAccess.ReadWrite, FileShare.Write | FileShare.Delete, true);
MoveTest (FileAccess.ReadWrite, FileShare.ReadWrite | FileShare.Delete, true);
}
[DllImport ("libc", SetLastError=true)]
public static extern int symlink (string oldpath, string newpath);
[Test]
[Category ("NotWasm")]
public void SymLinkStats() {
if (!RunningOnUnix)
Assert.Ignore ("Symlink are hard on windows");
var name1 = Path.GetRandomFileName ();
var name2 = Path.GetRandomFileName ();
var path1 = Path.Combine (Path.GetTempPath (), name1);
var path2 = Path.Combine (Path.GetTempPath (), name2);
File.Delete (path1);
File.Delete (path2);
try {
using (var f = File.Create(path1)) {
Assert.IsNotNull (f, "Path1 must be created for symlink stats");
}
if (symlink (path1, path2) != 0)
Assert.Fail ("symlink #1 failed with errno={0}", Marshal.GetLastWin32Error ());
Assert.IsTrue (File.Exists (path1), "File.Exists must return true for path1 symlink stats");
Assert.IsTrue (File.Exists (path2), "File.Exists must return true for path2 symlink stats");
try {
File.SetLastWriteTime (path1, DateTime.Now.AddMinutes(-5));
File.SetCreationTime (path1, DateTime.Now.AddMinutes(-5));
File.SetLastAccessTime (path1, DateTime.Now.AddMinutes(-5));
Assert.AreNotEqual (File.GetLastWriteTime(path1), File.GetLastWriteTime (path2), "Path1 and Path2 should not have the same last write times");
Assert.AreNotEqual (File.GetCreationTime(path1), File.GetCreationTime (path2), "Path1 and Path2 should not have the same creation times");
Assert.AreNotEqual (File.GetLastAccessTime(path1), File.GetLastAccessTime (path2), "Path1 and Path2 should not have the same last access times");
}
catch(IOException e) {
Assert.Fail ("Symlink stats should allow setting/getting time on file");
}
File.Delete (path2);
Assert.IsTrue (File.Exists(path1), "Original file must still exist for symlink stats");
Assert.IsFalse (File.Exists(path2), "File.Delete must delete symlink only for symlink stats");
File.Delete (path1);
Assert.IsFalse (File.Exists (path1), "File.Delete must delete symlink stats");
} finally {
try {
File.Delete (path1);
File.Delete (path2);
} catch (IOException) {
//Don't double fault any exception from the tests.
}
}
}
[Test]
#if MONOTOUCH_TV
[Ignore ("See bug #59239")]
#endif
[Category ("NotWasm")]
public void SymLinkLoop ()
{
if (!RunningOnUnix)

View File

@@ -284,6 +284,7 @@ namespace MonoTests.System.IO
}
[Test]
[Category ("MultiThreaded")]
public void BeginRead ()
{
byte [] readBytes = new byte [5];
@@ -294,6 +295,7 @@ namespace MonoTests.System.IO
}
[Test]
[Category ("MultiThreaded")]
public void BeginRead_WithState ()
{
byte [] readBytes = new byte [5];
@@ -316,6 +318,7 @@ namespace MonoTests.System.IO
}
[Test]
[Category ("MultiThreaded")]
public void BeginReadAsync ()
{
byte[] readBytes = new byte[5];
@@ -375,6 +378,7 @@ namespace MonoTests.System.IO
}
[Test]
[Category ("MultiThreaded")]
public void BeginRead_Read ()
{
byte[] readBytes = new byte[5];
@@ -433,6 +437,7 @@ namespace MonoTests.System.IO
}
[Test]
[Category ("MultiThreaded")]
public void BeginWrite ()
{
var writeBytes = new byte [5] { 2, 3, 4, 10, 12 };
@@ -443,6 +448,7 @@ namespace MonoTests.System.IO
}
[Test]
[Category ("MultiThreaded")]
public void BeginWrite_WithState ()
{
var writeBytes = new byte[5] { 2, 3, 4, 10, 12 };
@@ -465,6 +471,7 @@ namespace MonoTests.System.IO
}
[Test]
[Category ("MultiThreaded")]
public void EndRead_Twice ()
{
byte[] readBytes = new byte[5];
@@ -482,6 +489,7 @@ namespace MonoTests.System.IO
}
[Test]
[Category ("MultiThreaded")]
public void EndRead_Disposed ()
{
byte[] readBytes = new byte[5];
@@ -493,6 +501,7 @@ namespace MonoTests.System.IO
}
[Test]
[Category ("MultiThreaded")]
public void EndWrite_OnBeginRead ()
{
byte[] readBytes = new byte[5];
@@ -510,6 +519,7 @@ namespace MonoTests.System.IO
}
[Test]
[Category ("MultiThreaded")]
public void EndWrite_Twice ()
{
var wBytes = new byte[5];

View File

@@ -121,6 +121,7 @@ namespace MonoTests.System.IO
}
[Test]
[Category ("MultiThreaded")]
public void CopyAsync ()
{
var ms = new MockStream (true, false, true);
@@ -131,6 +132,7 @@ namespace MonoTests.System.IO
}
[Test]
[Category ("MultiThreaded")]
public void FlushAsync ()
{
bool called = false;
@@ -142,6 +144,7 @@ namespace MonoTests.System.IO
}
[Test]
[Category ("MultiThreaded")]
public void FlushAsync_Exception ()
{
var ms = new MockStream (false, false, false);
@@ -155,6 +158,7 @@ namespace MonoTests.System.IO
}
[Test]
[Category ("MultiThreaded")]
public void ReadAsync ()
{
bool called = false;
@@ -169,6 +173,7 @@ namespace MonoTests.System.IO
}
[Test]
[Category ("MultiThreaded")]
public void ReadAsync_Exception ()
{
var buffer = new byte[4];
@@ -184,6 +189,7 @@ namespace MonoTests.System.IO
}
[Test]
[Category ("MultiThreaded")]
public void WriteAsync ()
{
bool called = false;
@@ -197,6 +203,7 @@ namespace MonoTests.System.IO
}
[Test]
[Category ("MultiThreaded")]
public void WriteAsync_Exception ()
{
var buffer = new byte[4];

View File

@@ -1059,6 +1059,7 @@ namespace MonoTests.System.IO
}
[Test]
[Category ("MultiThreaded")]
public void FlushAsync ()
{
ManualResetEvent mre = new ManualResetEvent (false);

View File

@@ -29,12 +29,12 @@ namespace MonoTests.System.IO
public void UpdateLine ()
{
CoreNewLine = new char [] {'Z'};
NewLine = "Z";
}
public void UpdateLine2 ()
{
CoreNewLine [0] = 'Y';
NewLine = "Y";
}
}

View File

@@ -95,22 +95,6 @@ namespace MonoTests.System.IO
ums.Close();
}
[Test]
public void Constructor1_Length_Negative ()
{
try {
new UnmanagedMemoryStream(mem_byteptr, -1);
Assert.Fail ("#1");
} catch (ArgumentOutOfRangeException ex) {
// Non-negative number required
Assert.AreEqual (typeof (ArgumentOutOfRangeException), ex.GetType (), "#2");
Assert.IsNull (ex.InnerException, "#3");
Assert.IsNotNull (ex.Message, "#4");
Assert.IsNotNull (ex.ParamName, "#5");
Assert.AreEqual ("length", ex.ParamName, "#6");
}
}
[Test]
public void Constructor1_Pointer_Null ()
{
@@ -1008,7 +992,6 @@ namespace MonoTests.System.IO
Assert.IsNull (ex.InnerException, "#3");
Assert.IsNotNull (ex.Message, "#4");
Assert.IsNotNull (ex.ParamName, "#5");
Assert.AreEqual ("length", ex.ParamName, "#6");
}
ums.Close();
}

View File

@@ -1112,6 +1112,7 @@ public class AssemblyNameTest {
[Test]
[Category ("AndroidNotWorking")] // Accessing assemblies by asm.Location is not supported
[Category ("StaticLinkedAotNotWorking")] // Can't find .dll files when bundled in .exe
[Category ("NotWasm")]
public void GetAssemblyName_CodeBase ()
{
Assembly execAssembly = Assembly.GetExecutingAssembly ();

Some files were not shown because too many files have changed in this diff Show More