Imported Upstream version 4.8.0.309

Former-commit-id: 5f9c6ae75f295e057a7d2971f3a6df4656fa8850
This commit is contained in:
Xamarin Public Jenkins (auto-signing)
2016-11-10 13:04:39 +00:00
parent ee1447783b
commit 94b2861243
4912 changed files with 390737 additions and 49310 deletions

View File

@@ -1 +1 @@
7479bc775b28da65130781710df3ce18d64e9e33
7054084409dab3c72f7be13a1ddc4df6b7c49d9f

View File

@@ -53,7 +53,6 @@ namespace MonoTests.System.Collections.Generic
}
}
#if NET_4_5
[Test]
public void Create ()
{
@@ -70,7 +69,6 @@ namespace MonoTests.System.Collections.Generic
} catch (ArgumentNullException) {
}
}
#endif
[Test]
public void DefaultComparer_UserComparable ()

View File

@@ -770,7 +770,7 @@ namespace MonoTests.System.Collections
for (int i = 0; i < 20; i++)
sl1.RemoveAt (9);
Assert.AreEqual (30, sl1.Count, 30, "#C1");
Assert.AreEqual (30, (double) sl1.Count, 30, "#C1");
for (int i = 0; i < 9; i++)
Assert.AreEqual (i, sl1 ["kala " + string.Format ("{0:D2}", i)], "#C2:" + i);
for (int i = 9; i < 29; i++)

View File

@@ -12,6 +12,7 @@ using System.Globalization;
using System.IO;
using System.Runtime.Serialization.Formatters.Binary;
using System.Threading;
using System.Threading.Tasks;
using NUnit.Framework;
@@ -623,7 +624,6 @@ namespace MonoTests.System.Globalization
Assert.IsFalse (zh2.Equals (zh1), "#2");
}
#if NET_4_5
CountdownEvent barrier = new CountdownEvent (3);
AutoResetEvent[] evt = new AutoResetEvent [] { new AutoResetEvent (false), new AutoResetEvent (false), new AutoResetEvent (false), new AutoResetEvent (false)};
@@ -728,21 +728,42 @@ namespace MonoTests.System.Globalization
}
[Test]
public void DefaultThreadCurrentCultureAndNumberFormaters () {
public void DefaultThreadCurrentCultureIsIgnoredWhenCultureFlowsToThread ()
{
string us_str = null;
string br_str = null;
var thread = new Thread (() => {
CultureInfo.DefaultThreadCurrentCulture = new CultureInfo("en-US");
us_str = 100000.ToString ("C");
CultureInfo.DefaultThreadCurrentCulture = new CultureInfo("pt-BR");
br_str = 100000.ToString ("C");
});
var expected = 100000.ToString ("C");
thread.Start ();
thread.Join ();
Assert.IsTrue (thread.Join (5000), "#0");
CultureInfo.DefaultThreadCurrentCulture = null;
Assert.AreEqual ("$100,000.00", us_str, "#1");
Assert.AreEqual ("R$ 100.000,00", br_str, "#2");
Assert.AreEqual (expected, us_str, "#1");
Assert.AreEqual (expected, br_str, "#2");
}
[Test]
public void FlowCultureInfoFromParentThreadSinceNet46 ()
{
if (SynchronizationContext.Current != null) {
Assert.Ignore ();
return;
}
Func<Task> f = async () => {
Thread.CurrentThread.CurrentUICulture = new CultureInfo ("pt-BR");
await Task.Yield ();
Assert.AreEqual ("pt-BR", Thread.CurrentThread.CurrentUICulture.Name);
};
Assert.IsTrue (f ().Wait (5 * 1000), "#1");
}
#endif
}
}

View File

@@ -124,7 +124,7 @@ namespace MonoTests.System.IO.IsolatedStorageTest {
IsolatedStorageFile isf = IsolatedStorageFile.GetUserStoreForAssembly ();
Assert.AreEqual (Int64.MaxValue, isf.MaximumSize, "MaximumSize");
Assert.AreEqual (IsolatedStorageScope.User | IsolatedStorageScope.Assembly, isf.Scope, "Scope");
#if !NET_2_1
#if !MOBILE
Assert.IsTrue ((isf.AssemblyIdentity is Url), "AssemblyIdentity");
// note: mono transforms the CodeBase into uppercase
// for net 1.1 which uses file:// and not file:///
@@ -157,7 +157,7 @@ namespace MonoTests.System.IO.IsolatedStorageTest {
IsolatedStorageFile isf = IsolatedStorageFile.GetUserStoreForDomain ();
Assert.AreEqual (Int64.MaxValue, isf.MaximumSize, "MaximumSize");
Assert.AreEqual (IsolatedStorageScope.User | IsolatedStorageScope.Domain | IsolatedStorageScope.Assembly, isf.Scope, "Scope");
#if !NET_2_1
#if !MOBILE
Assert.IsTrue ((isf.AssemblyIdentity is Url), "AssemblyIdentity");
// note: mono transforms the CodeBase into uppercase
// for net 1.1 which uses file:// and not file:///
@@ -198,7 +198,7 @@ namespace MonoTests.System.IO.IsolatedStorageTest {
{
IsolatedStorageFile isf = IsolatedStorageFile.GetUserStoreForApplication ();
Assert.AreEqual (Int64.MaxValue, isf.MaximumSize, "MaximumSize");
#if !NET_2_1
#if !MOBILE
Assert.AreEqual (IsolatedStorageScope.User | IsolatedStorageScope.Assembly, isf.Scope, "Scope");
Assert.IsTrue ((isf.AssemblyIdentity is Url), "AssemblyIdentity");
Assert.IsTrue ((isf.AssemblyIdentity.ToString ().IndexOf (Assembly.GetExecutingAssembly ().CodeBase) > 0), "Url");
@@ -206,7 +206,7 @@ namespace MonoTests.System.IO.IsolatedStorageTest {
Assert.IsTrue ((isf.CurrentSize >= 0), "CurrentSize");
}
#if !NET_2_1
#if !MOBILE
[Test]
[ExpectedException (typeof (IsolatedStorageException))]
public void GetUserStoreForApplication_AssemblyIdentity ()
@@ -238,7 +238,7 @@ namespace MonoTests.System.IO.IsolatedStorageTest {
IsolatedStorageScope scope = IsolatedStorageScope.User | IsolatedStorageScope.Domain | IsolatedStorageScope.Assembly;
IsolatedStorageFile isf = IsolatedStorageFile.GetStore (scope, typeof (Zone), typeof (Zone));
Assert.AreEqual (Int64.MaxValue, isf.MaximumSize, "MaximumSize");
#if !NET_2_1
#if !MOBILE
Assert.AreEqual (IsolatedStorageScope.User | IsolatedStorageScope.Domain | IsolatedStorageScope.Assembly, isf.Scope, "Scope");
Assert.IsTrue ((isf.AssemblyIdentity is Zone), "AssemblyIdentity");
Assert.IsTrue ((isf.AssemblyIdentity.ToString ().IndexOf ("MyComputer") > 0), "Zone - Assembly");
@@ -265,7 +265,7 @@ namespace MonoTests.System.IO.IsolatedStorageTest {
IsolatedStorageFile isf = IsolatedStorageFile.GetStore (scope, typeof (StrongName), typeof (Url));
Assert.AreEqual (Int64.MaxValue, isf.MaximumSize, "MaximumSize");
Assert.AreEqual (scope, isf.Scope, "Scope");
#if !NET_2_1
#if !MOBILE
Assert.IsTrue ((isf.AssemblyIdentity is Url), "AssemblyIdentity");
// note: mono transforms the CodeBase into uppercase
// for net 1.1 which uses file:// and not file:///
@@ -361,7 +361,7 @@ namespace MonoTests.System.IO.IsolatedStorageTest {
// Maximum size for Internet isn't (by default) Int64.MaxValue
Assert.AreEqual (scope, isf.Scope, "Scope");
#if !NET_2_1
#if !MOBILE
Assert.IsTrue ((isf.AssemblyIdentity is Zone), "AssemblyIdentity");
Assert.IsTrue ((isf.AssemblyIdentity.ToString ().IndexOf ("Intranet") > 0), "Zone - Assembly");
Assert.IsTrue ((isf.DomainIdentity is Zone), "DomainIdentity");
@@ -577,7 +577,7 @@ namespace MonoTests.System.IO.IsolatedStorageTest {
{
IsolatedStorageScope scope = IsolatedStorageScope.User | IsolatedStorageScope.Roaming | IsolatedStorageScope.Assembly | IsolatedStorageScope.Domain;
IsolatedStorageFile isf = IsolatedStorageFile.GetStore (scope, null, null);
#if !NET_2_1
#if !MOBILE
Assert.AreEqual (typeof (Url), isf.AssemblyIdentity.GetType (), "AssemblyIdentity");
Assert.AreEqual (typeof (Url), isf.DomainIdentity.GetType (), "DomainIdentity");
#endif

View File

@@ -168,6 +168,8 @@ namespace MonoTests.System.IO
info = new DirectoryInfo ("/test/");
Assert.AreEqual ("test", info.Name, "#4");
} else {
Directory.SetCurrentDirectory (@"C:\");
info = new DirectoryInfo (@"c:");
Assert.AreEqual (@"C:\", info.Name, "#4");
@@ -217,6 +219,8 @@ namespace MonoTests.System.IO
Assert.IsNotNull (info.Parent, "#7a");
Assert.AreEqual ("/", info.Parent.FullName, "#7b");
} else {
Directory.SetCurrentDirectory (@"C:\");
info = new DirectoryInfo (@"c:");
Assert.IsNull (info.Parent, "#4");
@@ -418,6 +422,8 @@ namespace MonoTests.System.IO
di = new DirectoryInfo ("/test/");
Assert.AreEqual ("/test/", di.FullName, "#D4");
} else {
Directory.SetCurrentDirectory (@"C:\");
di = new DirectoryInfo (@"c:");
Assert.AreEqual (@"C:\", di.FullName, "#D1");

View File

@@ -758,9 +758,9 @@ namespace MonoTests.System.IO
try {
info.MoveTo (destFile);
Assert.Fail ("#1");
} catch (FileNotFoundException ex) {
} catch (DirectoryNotFoundException ex) {
// Could not find a part of the path
Assert.AreEqual (typeof (FileNotFoundException), ex.GetType (), "#2");
Assert.AreEqual (typeof (DirectoryNotFoundException), ex.GetType (), "#2");
Assert.IsNull (ex.InnerException, "#3");
Assert.IsNotNull (ex.Message, "#4");
}

View File

@@ -17,7 +17,7 @@ namespace MonoTests.System.IO
[TestFixture]
public class FileStreamWithClosedSafeHandleTests
{
#if !NET_2_1
#if !MOBILE
private FileStream GetFileStreamWithClosedHandle ()
{
var fs1 = new FileStream ("test2", FileMode.OpenOrCreate);

View File

@@ -25,10 +25,6 @@ namespace MonoTests.System.IO
{
string TempFolder = Path.Combine (Path.GetTempPath (), "MonoTests.System.IO.Tests");
static readonly char DSC = Path.DirectorySeparatorChar;
static bool MacOSX = false;
[DllImport ("libc")]
static extern int uname (IntPtr buf);
[TearDown]
public void TearDown ()
@@ -44,13 +40,6 @@ namespace MonoTests.System.IO
Directory.Delete (TempFolder, true);
Directory.CreateDirectory (TempFolder);
#if !MOBILE
// from XplatUI.cs
IntPtr buf = Marshal.AllocHGlobal (8192);
if (uname (buf) == 0)
MacOSX = Marshal.PtrToStringAnsi (buf) == "Darwin";
Marshal.FreeHGlobal (buf);
#endif
}
public void TestCtr ()

View File

@@ -17,9 +17,7 @@ using System.IO;
using System.Runtime.Serialization.Formatters.Binary;
using System.Text;
using System.Threading;
#if NET_4_5
using System.Threading.Tasks;
#endif
using NUnit.Framework;
@@ -1119,7 +1117,6 @@ namespace MonoTests.System.IO
Assert.IsTrue (ms.DisposedCalled, "After");
}
#if NET_4_5
[Test]
public void ReadAsync ()
{
@@ -1323,6 +1320,5 @@ namespace MonoTests.System.IO
return true;
}
}
#endif
}
}

View File

@@ -37,6 +37,7 @@ namespace MonoTests.System.IO
static string path3;
static OsType OS;
static char DSC = Path.DirectorySeparatorChar;
static char ADSC = Path.AltDirectorySeparatorChar;
[SetUp]
public void SetUp ()
@@ -359,6 +360,12 @@ namespace MonoTests.System.IO
}
}
[Test]
public void GetDirectoryName_Replaces_AltDirectorySeparatorChar ()
{
Assert.AreEqual ($"foo{DSC}bar", Path.GetDirectoryName ($"foo{ADSC}bar{ADSC}dingus"), "#1");
}
[Test]
public void GetExtension ()
{
@@ -688,6 +695,11 @@ namespace MonoTests.System.IO
i, root + test [i, 0], ex.GetType ()));
}
}
// These cases require that we don't pass a root to GetFullPath - it should return the proper drive root.
string root4 = Path.GetPathRoot(Directory.GetCurrentDirectory());
Assert.AreEqual(root4, Path.GetFullPath(@"\"));
Assert.AreEqual(root4, Path.GetFullPath("/"));
}
[Test]

View File

@@ -9,9 +9,7 @@
using System;
using System.IO;
using System.Text;
#if NET_4_5
using System.Threading.Tasks;
#endif
using NUnit.Framework;
@@ -845,7 +843,6 @@ public class StreamReaderTest
Assert.AreEqual (0, StreamReader.Null.ReadBlock (buffer, 0, buffer.Length));
}
#if NET_4_5
[Test]
public void ReadLineAsync ()
{
@@ -866,7 +863,6 @@ public class StreamReaderTest
Assert.IsTrue (result.Wait (3000), "#1");
Assert.AreEqual ("ab" + Environment.NewLine, result.Result);
}
#endif
}
class MyStream : Stream {

View File

@@ -120,7 +120,6 @@ namespace MonoTests.System.IO
Assert.IsFalse (s.CanRead, "#1");
}
#if NET_4_5
[Test]
public void CopyAsync ()
{
@@ -211,6 +210,5 @@ namespace MonoTests.System.IO
} catch (AggregateException) {
}
}
#endif
}
}

View File

@@ -1051,7 +1051,6 @@ namespace MonoTests.System.IO
Assert.AreEqual (5, ms.Position, "#2");
}
#if NET_4_5
[Test]
public void FlushAsync ()
{
@@ -1098,7 +1097,6 @@ namespace MonoTests.System.IO
Assert.IsTrue (t.Wait (1000), "#5");
}
#endif
// TODO - Write - test errors, functionality tested in TestFlush.
}

View File

@@ -656,7 +656,7 @@ namespace MonoTests.System.Reflection.Emit
Assert.AreEqual ("FOO", ((ObsoleteAttribute) attrs [0]).Message, "#B3");
}
}
#if !NET_2_1
#if !MOBILE
[Test]
[ExpectedException (typeof (InvalidOperationException))]
public void TestAddDeclarativeSecurityAlreadyCreated ()

View File

@@ -1152,10 +1152,8 @@ public class AssemblyNameTest {
Assert.IsNull (an.GetPublicKey (), "GetPublicKey");
Assert.IsNull (an.GetPublicKeyToken (), "GetPublicKeyToken");
Assert.AreEqual ("TestAssembly", an.ToString (), "ToString");
#if NET_4_5
Assert.IsNull (an.CultureName, "CultureName");
Assert.AreEqual (AssemblyContentType.Default, an.ContentType, "ContentType");
#endif
}
[Test] // ctor (String)

File diff suppressed because it is too large Load Diff

View File

@@ -26,7 +26,6 @@
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
#if NET_4_5
using System;
using System.Reflection;
@@ -54,4 +53,3 @@ namespace MonoTests.System.Reflection
}
}
#endif

View File

@@ -24,13 +24,26 @@ namespace MonoTests.System.Reflection
[TestFixture]
public class ModuleTest
{
static string TempFolder = Path.Combine (Path.GetTempPath (), "MonoTests.System.Reflection.ModuleTest");
static string BaseTempFolder = Path.Combine (Path.GetTempPath (), "MonoTests.System.Reflection.ModuleTest");
static string TempFolder;
[TestFixtureSetUp]
public void FixtureSetUp ()
{
try {
// Try to cleanup from any previous NUnit run.
Directory.Delete (BaseTempFolder, true);
} catch (Exception) {
}
}
[SetUp]
public void SetUp ()
{
while (Directory.Exists (TempFolder))
TempFolder = Path.Combine (TempFolder, "2");
int i = 0;
do {
TempFolder = Path.Combine (BaseTempFolder, (++i).ToString());
} while (Directory.Exists (TempFolder));
Directory.CreateDirectory (TempFolder);
}
@@ -38,8 +51,8 @@ public class ModuleTest
public void TearDown ()
{
try {
// This throws an exception under MS.NET, since the directory contains loaded
// assemblies.
// This throws an exception under MS.NET and Mono on Windows,
// since the directory contains loaded assemblies.
Directory.Delete (TempFolder, true);
} catch (Exception) {
}

View File

@@ -71,7 +71,7 @@ namespace MonoTests.System.Reflection.Emit
#if !MOBILE
Assert.AreEqual ("foo.type[[System.Double, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089],[System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]", inst.FullName, "#3");
Assert.AreEqual ("foo.type[[System.Double, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089],[System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]], MonoTests.System.Reflection.Emit.MonoGenericClassTest, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null", inst.AssemblyQualifiedName, "#4");
#elif NET_2_1 || MOBILE
#elif MOBILE || MOBILE
Assert.AreEqual ("foo.type[[System.Double, mscorlib, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[System.String, mscorlib, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]]", inst.FullName, "#3");
Assert.AreEqual ("foo.type[[System.Double, mscorlib, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[System.String, mscorlib, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]], MonoTests.System.Reflection.Emit.MonoGenericClassTest, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null", inst.AssemblyQualifiedName, "#4");
Assert.AreEqual ("foo.type[System.Double,System.String]", inst.ToString (), "#5");

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