Imported Upstream version 4.3.2.467

Former-commit-id: 9c2cb47f45fa221e661ab616387c9cda183f283d
This commit is contained in:
Xamarin Public Jenkins
2016-02-22 11:00:01 -05:00
parent f302175246
commit f3e3aab35a
4097 changed files with 122406 additions and 82300 deletions

View File

@@ -27,6 +27,9 @@ namespace MonoTests.Microsoft.CSharp
private static readonly string _sourceLibrary1 = "public class Test1 {}";
private static readonly string _sourceLibrary2 = "public class Test2 {}";
private static readonly string _sourceLibrary3 =
@"public class Test3 { public void F() { } }
public class Test4 : Test3 { public void F() { } }";
private static readonly string _sourceExecutable = "public class Program { static void Main () { } }";
[SetUp]
@@ -547,6 +550,22 @@ namespace MonoTests.Microsoft.CSharp
Assert.AreEqual (tempFile, tempFiles[0], "#4");
}
[Test]
public void MultiLineWarningIsReportedAsOneWarning()
{
CompilerParameters options = new CompilerParameters ();
options.GenerateExecutable = false;
options.GenerateInMemory = true;
options.TempFiles = new TempFileCollection (_tempDir);
ICodeCompiler compiler = _codeProvider.CreateCompiler ();
CompilerResults results = compiler.CompileAssemblyFromSource (options,
_sourceLibrary3);
// verify compilation was successful
AssertCompileResults (results, true);
}
private static string CreateTempDirectory ()
{
// create a uniquely named zero-byte file

View File

@@ -1,4 +1,3 @@
#if NET_4_0
// BlockingCollectionTests.cs
//
// Copyright (c) 2008 Jérémie "Garuma" Laval
@@ -283,4 +282,3 @@ namespace MonoTests.System.Collections.Concurrent
}
}
}
#endif

View File

@@ -1,4 +1,3 @@
#if NET_4_0
//
// CollectionStressTestHelper.cs
//
@@ -131,4 +130,3 @@ namespace MonoTests.System.Collections.Concurrent
}
}
}
#endif

View File

@@ -24,7 +24,6 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
#if NET_4_0
using System;
using System.Collections;
@@ -265,4 +264,3 @@ namespace MonoTests.System.Collections.Concurrent
}
}
}
#endif

View File

@@ -1,4 +1,3 @@
#if NET_4_0
// TestHelper.cs
//
// Copyright (c) 2008 Jérémie "Garuma" Laval
@@ -86,4 +85,3 @@ namespace MonoTests.System.Collections.Concurrent
}
}
}
#endif

View File

@@ -26,7 +26,6 @@
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
#if NET_4_0
using System;
using System.Collections;
@@ -540,4 +539,3 @@ namespace MonoTests.System.Collections.Generic
}
}
#endif

View File

@@ -21,7 +21,6 @@
// Brian O'Keefe (zer0keefie@gmail.com)
//
#if NET_4_0
using System.Collections;
using NUnit.Framework;
@@ -102,4 +101,3 @@ namespace MonoTests.System.Collections.Specialized {
}
}
#endif

View File

@@ -26,7 +26,6 @@
// Marek Safar (marek.safar@gmail.com)
//
#if NET_4_0
using System.Collections.ObjectModel;
using System.Collections.Specialized;
@@ -349,4 +348,3 @@ namespace MonoTests.System.Collections.ObjectModel {
}
}
#endif

View File

@@ -21,7 +21,6 @@
// Brian O'Keefe (zer0keefie@gmail.com)
//
#if NET_4_0
using System.Collections.Generic;
using System.Collections.ObjectModel;
@@ -93,4 +92,3 @@ namespace MonoTests.System.Collections.ObjectModel {
}
}
#endif

View File

@@ -35,7 +35,6 @@ namespace MonoTests.System.ComponentModel {
[TestFixture]
public class AttributeCollectionTest {
#if NET_4_0
[Test]
public void Ctor_4_0 ()
{
@@ -76,7 +75,6 @@ namespace MonoTests.System.ComponentModel {
return Attributes;
}
}
#endif
}
}

View File

@@ -197,7 +197,6 @@ namespace MonoTests.System.ComponentModel
}
}
#if NET_4_0
[Test]
public void GetCultureName ()
{
@@ -217,6 +216,5 @@ namespace MonoTests.System.ComponentModel
return base.GetCultureName (culture);
}
}
#endif
}
}

View File

@@ -26,7 +26,7 @@
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
#if NET_4_0 && !MOBILE
#if !MOBILE
using System;
using System.ComponentModel;

View File

@@ -400,10 +400,8 @@ namespace MonoTests.System.ComponentModel
#if MOBILE
[TypeConverter("System.ComponentModel.CharConverter, System, Version=2.0.5.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")]
#elif NET_4_0
[TypeConverter("System.ComponentModel.CharConverter, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")]
#else
[TypeConverter("System.ComponentModel.CharConverter, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")]
[TypeConverter("System.ComponentModel.CharConverter, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")]
#endif
public virtual Version WithConverterNamedAssmQuald {
get { return null; }

View File

@@ -37,7 +37,6 @@ namespace MonoTests.System.ComponentModel
[TestFixture]
public class TypeDescriptionProviderTest
{
#if NET_4_0
[Test]
public void IsSupportedType ()
{
@@ -71,7 +70,6 @@ namespace MonoTests.System.ComponentModel
return base.GetExtenderProviders (instance);
}
}
#endif
}
}

View File

@@ -29,8 +29,11 @@
//#define SPEW
using System;
using System.IO;
using System.Xml;
using System.Xml.Serialization;
using System.Xml.Schema;
using System.Text;
using System.Configuration;
using System.ComponentModel;
@@ -284,16 +287,7 @@ namespace MonoTests.System.Configuration {
[Test]
public void TestSettings2_Properties ()
{
// This test will fail when there are newer versions
// of the test assemblies - so conditionalize it in
// such cases.
#if NET_4_5
string expected = "MonoTests.System.Configuration.ProviderPoker, System_test_net_4_5, Version=0.0.0.0";
#elif NET_4_0
string expected = "MonoTests.System.Configuration.ProviderPoker, System_test_net_4_0, Version=0.0.0.0";
#else
string expected = "MonoTests.System.Configuration.ProviderPoker, System_test_net_2_0, Version=0.0.0.0";
#endif
string expected = "MonoTests.System.Configuration.ProviderPoker, System_test_net_4_x, Version=0.0.0.0";
Assert.AreEqual (expected, new SettingsProviderAttribute (typeof (ProviderPoker)).ProviderTypeName.Substring (0, expected.Length), "#1");
TestSettings2 settings = new TestSettings2 ();
@@ -470,6 +464,60 @@ namespace MonoTests.System.Configuration {
Assert.AreEqual ("eclair", holder1.TestKey, "#4");
Assert.AreEqual ("", holder2.TestKey, "#5");
}
class Settings : ApplicationSettingsBase
{
[UserScopedSetting]
public WindowPositionList WindowPositions {
get {
return ((WindowPositionList)(this ["WindowPositions"]));
}
set {
this ["WindowPositions"] = value;
}
}
}
[Serializable]
public class WindowPositionList : IXmlSerializable
{
public XmlSchema GetSchema ()
{
return null;
}
public void ReadXml (XmlReader reader)
{
reader.ReadStartElement ("sampleNode");
reader.ReadEndElement ();
}
public void WriteXml (XmlWriter writer)
{
writer.WriteStartElement ("sampleNode");
writer.WriteEndElement ();
}
}
[Test] //Covers 36388
public void XmlHeader ()
{
try {
var settings = new Settings ();
settings.Reset ();
settings.Save ();
settings.WindowPositions = new WindowPositionList ();
settings.Save ();
// If Reloads fails then saved data is corrupted
settings.Reload ();
} catch (ConfigurationErrorsException e) {
// Delete corrupted config file so other test won't fail.
File.Delete (e.Filename);
Assert.Fail ("Invalid data was saved to config file.");
}
}
}
}

View File

@@ -8,6 +8,8 @@
// (c) 2007 Novell, Inc. (http://www.novell.com)
//
#if MONO_FEATURE_PROCESS_START
using System;
using System.Diagnostics;
using System.Text;
@@ -62,3 +64,5 @@ namespace MonoTests.System.Diagnostics
}
}
}
#endif // MONO_FEATURE_PROCESS_START

View File

@@ -104,6 +104,7 @@ namespace MonoTests.System.Diagnostics
}
}
#if MONO_FEATURE_PROCESS_START
[Test] // Start ()
public void Start1_FileName_Empty ()
{
@@ -732,8 +733,6 @@ namespace MonoTests.System.Diagnostics
public int bytesRead = -1;
// Not technically a 2.0 only test, but I use lambdas, so I need gmcs
[Test]
[NUnit.Framework.Category ("MobileNotWorking")]
// This was for bug #459450
@@ -791,9 +790,11 @@ namespace MonoTests.System.Diagnostics
p.StartInfo.RedirectStandardError = true;
var exitedCalledCounter = 0;
var exited = new ManualResetEventSlim ();
p.Exited += (object sender, EventArgs e) => {
exitedCalledCounter++;
Assert.IsTrue (p.HasExited);
exited.Set ();
};
p.EnableRaisingEvents = true;
@@ -803,6 +804,7 @@ namespace MonoTests.System.Diagnostics
p.BeginOutputReadLine ();
p.WaitForExit ();
exited.Wait (10000);
Assert.AreEqual (1, exitedCalledCounter);
Thread.Sleep (50);
Assert.AreEqual (1, exitedCalledCounter);
@@ -822,9 +824,11 @@ namespace MonoTests.System.Diagnostics
p.EnableRaisingEvents = true;
var exitedCalledCounter = 0;
var exited = new ManualResetEventSlim ();
p.Exited += (object sender, EventArgs e) => {
exitedCalledCounter++;
Assert.IsTrue (p.HasExited);
exited.Set ();
};
p.Start ();
@@ -832,12 +836,38 @@ namespace MonoTests.System.Diagnostics
p.BeginOutputReadLine ();
p.WaitForExit ();
Assert.IsTrue (exited.Wait (10000));
Assert.AreEqual (1, exitedCalledCounter);
Thread.Sleep (50);
Assert.AreEqual (1, exitedCalledCounter);
}
[Test]
[NUnit.Framework.Category ("MobileNotWorking")]
public void TestDisableEventsBeforeExitedEvent ()
{
Process p = new Process ();
p.StartInfo = GetCrossPlatformStartInfo ();
p.StartInfo.UseShellExecute = false;
p.StartInfo.RedirectStandardOutput = true;
p.StartInfo.RedirectStandardError = true;
p.EnableRaisingEvents = false;
var exitedCalledCounter = 0;
p.Exited += (object sender, EventArgs e) => {
exitedCalledCounter++;
};
p.Start ();
p.BeginErrorReadLine ();
p.BeginOutputReadLine ();
p.WaitForExit ();
Assert.AreEqual (0, exitedCalledCounter);
}
ProcessStartInfo GetCrossPlatformStartInfo ()
{
if (RunningOnUnix) {
@@ -851,6 +881,7 @@ namespace MonoTests.System.Diagnostics
} else
return new ProcessStartInfo ("help", "");
}
#endif // MONO_FEATURE_PROCESS_START
[Test]
public void ProcessName_NotStarted ()
@@ -872,6 +903,7 @@ namespace MonoTests.System.Diagnostics
Assert.IsNull (e.InnerException, "IOE inner exception should be null");
}
#if MONO_FEATURE_PROCESS_START
[Test]
[NUnit.Framework.Category ("MobileNotWorking")]
public void ProcessName_AfterExit ()
@@ -902,6 +934,7 @@ namespace MonoTests.System.Diagnostics
Assert.IsNull (e.InnerException, "IOE inner exception should be null");
}
#endif // MONO_FEATURE_PROCESS_START
[Test]
public void Handle_ThrowsOnNotStarted ()
@@ -919,6 +952,7 @@ namespace MonoTests.System.Diagnostics
Assert.IsFalse (Process.GetCurrentProcess ().HasExited);
}
#if MONO_FEATURE_PROCESS_START
[Test]
[NUnit.Framework.Category ("MobileNotWorking")]
public void DisposeWithDisposedStreams ()
@@ -934,6 +968,22 @@ namespace MonoTests.System.Diagnostics
p.Dispose ();
}
[Test]
[NUnit.Framework.Category ("MobileNotWorking")]
public void StandardInputWrite ()
{
var psi = GetCrossPlatformStartInfo ();
psi.RedirectStandardInput = true;
psi.RedirectStandardOutput = true;
psi.UseShellExecute = false;
using (var p = Process.Start (psi)) {
for (int i = 0; i < 1024 * 9; ++i)
p.StandardInput.Write ('x');
}
}
#endif // MONO_FEATURE_PROCESS_START
[Test]
public void Modules () {
var modules = Process.GetCurrentProcess ().Modules;
@@ -968,5 +1018,47 @@ namespace MonoTests.System.Diagnostics
Assert.IsTrue (found, sb.ToString ());
}
}
#if MONO_FEATURE_PROCESS_START
[Test]
[NUnit.Framework.Category ("MobileNotWorking")]
[ExpectedException (typeof (InvalidOperationException))]
public void TestDoubleBeginOutputReadLine ()
{
using (Process p = new Process ()) {
p.StartInfo = GetCrossPlatformStartInfo ();
p.StartInfo.UseShellExecute = false;
p.StartInfo.RedirectStandardOutput = true;
p.StartInfo.RedirectStandardError = true;
p.Start ();
p.BeginOutputReadLine ();
p.BeginOutputReadLine ();
Assert.Fail ();
}
}
[Test]
[NUnit.Framework.Category ("MobileNotWorking")]
[ExpectedException (typeof (InvalidOperationException))]
public void TestDoubleBeginErrorReadLine ()
{
using (Process p = new Process ()) {
p.StartInfo = GetCrossPlatformStartInfo ();
p.StartInfo.UseShellExecute = false;
p.StartInfo.RedirectStandardOutput = true;
p.StartInfo.RedirectStandardError = true;
p.Start ();
p.BeginErrorReadLine ();
p.BeginErrorReadLine ();
Assert.Fail ();
}
}
#endif // MONO_FEATURE_PROCESS_START
}
}

View File

@@ -376,7 +376,6 @@ namespace MonoTests.System.IO.Compression
}
[Test]
[Category ("AndroidNotWorking")] // system zlib returns Z_STREAM_ERROR
public void Bug28777_EmptyFlush ()
{
MemoryStream backing = new MemoryStream ();
@@ -387,7 +386,6 @@ namespace MonoTests.System.IO.Compression
}
[Test]
[Category ("AndroidNotWorking")] // system zlib returns Z_BUF_ERROR
public void Bug28777_DoubleFlush ()
{
byte[] buffer = new byte [4096];

View File

@@ -389,5 +389,51 @@ namespace MonoTests.System.Net.Mail
Assert.AreEqual ("<bar@example.com>", server.rcpt_to);
}
[Test]
public void Deliver_Async ()
{
// SmtpClient uses BackgroundWorker and listens for the RunWorkerCompleted
// to mark an async task as completed. The problem is that BackgroundWorker uses
// System.ComponentModel.AsyncOperationManager to get the synchronization
// context, and in monotouch that returns by default a synchronization
// context for the main thread. Since tests are also run on the main thread,
// we'll block the main thread while waiting for the async send to complete,
// while the async completion is waiting for the main thread to process it.
// So instead use a SynchronizationContext that uses the threadpool instead
// of the main thread.
var existing_context = global::System.ComponentModel.AsyncOperationManager.SynchronizationContext;
global::System.ComponentModel.AsyncOperationManager.SynchronizationContext = new ThreadPoolSynchronizationContext ();
try {
var server = new SmtpServer ();
var client = new SmtpClient ("localhost", server.EndPoint.Port);
var msg = new MailMessage ("foo@example.com", "bar@example.com", "hello", "howdydoo\r\n");
Thread t = new Thread (server.Run);
t.Start ();
var task = client.SendMailAsync (msg);
t.Join ();
Assert.AreEqual ("<foo@example.com>", server.mail_from);
Assert.AreEqual ("<bar@example.com>", server.rcpt_to);
Assert.IsTrue (task.Wait (1000));
Assert.IsTrue (task.IsCompleted, "task");
} finally {
global::System.ComponentModel.AsyncOperationManager.SynchronizationContext = existing_context;
}
}
internal class ThreadPoolSynchronizationContext : SynchronizationContext
{
public override void Post (SendOrPostCallback d, object state)
{
ThreadPool.QueueUserWorkItem ((v) => d (state));
}
public override void Send (SendOrPostCallback d, object state)
{
d (state);
}
}
}
}

View File

@@ -87,7 +87,7 @@ namespace MonoTests.System.Net.Mime
}
[Test]
[ExpectedException (typeof (FormatException))]
[ExpectedException (typeof (IndexOutOfRangeException))]
public void FormatException ()
{
new ContentDisposition ("");
@@ -115,8 +115,7 @@ namespace MonoTests.System.Net.Mime
[Test]
public void ToStringTest ()
{
string rfc822 = "dd MMM yyyy HH':'mm':'ss zz00";
string modification_date = DateTime.MaxValue.ToString (rfc822);
string modification_date = "Fri, 31 Dec 9999 23:59:59 -0000";
string to_string = cd.ToString ();
Assert.IsTrue (to_string.StartsWith ("attachment; "), "#1");
Assert.IsTrue (to_string.Contains ("modification-date=\"" + modification_date + "\""), "#2");

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