Imported Upstream version 4.6.0.125

Former-commit-id: a2155e9bd80020e49e72e86c44da02a8ac0e57a4
This commit is contained in:
Xamarin Public Jenkins (auto-signing)
2016-08-03 10:59:49 +00:00
parent a569aebcfd
commit e79aa3c0ed
17047 changed files with 3137615 additions and 392334 deletions

View File

@@ -13,7 +13,7 @@ using System;
using System.Globalization;
using System.IO;
using System.Reflection;
#if !MONOTOUCH
#if !MONOTOUCH && !MOBILE_STATIC
using System.Reflection.Emit;
#endif
using System.Runtime.InteropServices;
@@ -311,7 +311,7 @@ namespace MonoTests.System {
Assert.AreEqual (7, objCOMTest.Id, "#A05");
}
#if !MONOTOUCH
#if !MONOTOUCH && !MOBILE_STATIC
[Test]
[ExpectedException (typeof (MissingMethodException))]
public void CreateInstance_TypeBuilder ()
@@ -513,7 +513,7 @@ namespace MonoTests.System {
null, null);
}
#if !MONOTOUCH
#if !MONOTOUCH && !MOBILE_STATIC
[Test]
public void CreateInstanceCustomDomain ()
{

View File

@@ -12,7 +12,7 @@
using System;
using System.Reflection;
#if !MONOTOUCH
#if !MONOTOUCH && !MOBILE_STATIC
using System.Reflection.Emit;
#endif
using System.Runtime.InteropServices;
@@ -846,7 +846,7 @@ namespace MonoTests.System
Assert.IsTrue (custom [2].GetType () == typeof (SerializableAttribute));
}
#if !MONOTOUCH
#if !MONOTOUCH && !MOBILE_STATIC
[Test]
public void GetCustomAttributeOnNewSreTypes ()
{

View File

@@ -1 +0,0 @@
30520808a4ce306cc6a0127dfc2830f59766d727

View File

@@ -1 +1 @@
f9dc5929d3107412fcd6141a8da70093abad780d
2124aa85733b05943c15d6c00f8c006ed856713e

View File

@@ -1571,7 +1571,7 @@ namespace MonoTests.System
{
decimal value = 1.600000m;
var roundedValue = Math.Round (value, 3);
Assert.AreEqual ("1.600", roundedValue.ToString (), "#1");
Assert.AreEqual ("1.600", roundedValue.ToString (CultureInfo.InvariantCulture), "#1");
}
[Test] // Bug Xamarin#17538
@@ -1585,7 +1585,6 @@ namespace MonoTests.System
}
[Test] // Bug Xamarin #24411
[Category ("MobileNotWorking")] // Bug Xamarin #27269
public void DecimalDivision_24411 ()
{
decimal dd = 45m;
@@ -1599,19 +1598,18 @@ namespace MonoTests.System
// The side effect is that 45m/100 should render as 0.45, not 0.4500000000000000000000000000
// Just for completeness:
Assert.AreEqual ("0.45", (45m/100).ToString ());
Assert.AreEqual ("0.45", (45m/100).ToString (CultureInfo.InvariantCulture));
}
[Test] // Bug SUSE #655780
[Category ("MobileNotWorking")] // Bug Xamarin #27269
public void TrailingZerosBug ()
{
decimal d;
Assert.AreEqual ("0", (0m/5).ToString ());
Assert.AreEqual ("0.2", (1m/5).ToString ());
Assert.AreEqual ("0.4", (2m/5).ToString ());
Assert.AreEqual ("0.6", (3m/5).ToString ());
Assert.AreEqual ("0.8", (4m/5).ToString ());
Assert.AreEqual ("0", (0m/5).ToString (CultureInfo.InvariantCulture));
Assert.AreEqual ("0.2", (1m/5).ToString (CultureInfo.InvariantCulture));
Assert.AreEqual ("0.4", (2m/5).ToString (CultureInfo.InvariantCulture));
Assert.AreEqual ("0.6", (3m/5).ToString (CultureInfo.InvariantCulture));
Assert.AreEqual ("0.8", (4m/5).ToString (CultureInfo.InvariantCulture));
}
}
}

View File

@@ -5,7 +5,7 @@
using System;
using System.Reflection;
#if !MONOTOUCH
#if !MONOTOUCH && !MOBILE_STATIC
using System.Reflection.Emit;
#endif
using System.Threading;
@@ -26,7 +26,7 @@ namespace MonoTests.System
[Test] //See bug #372406
#if MONOTOUCH
#if MONOTOUCH || MOBILE_STATIC
[Category ("NotWorking")] // #10539
#endif
public void CreateDelegate1_Method_Private_Instance ()
@@ -64,7 +64,7 @@ namespace MonoTests.System
}
[Test] // CreateDelegate (Type, MethodInfo)
#if MONOTOUCH
#if MONOTOUCH || MOBILE_STATIC
[Category ("NotWorking")] // #14163
#endif
public void CreateDelegate1_Method_Instance ()
@@ -925,7 +925,7 @@ namespace MonoTests.System
}
[Test]
#if MONOTOUCH
#if MONOTOUCH || MOBILE_STATIC
[Category ("NotWorking")] // #10539
#endif
public void Virtual ()
@@ -956,7 +956,7 @@ namespace MonoTests.System
}
[Test]
#if MONOTOUCH
#if MONOTOUCH || MOBILE_STATIC
[Category ("NotWorking")] // #14163
#endif
public void NullTarget_Instance ()
@@ -1021,7 +1021,7 @@ namespace MonoTests.System
}
[Test] // #617161
#if MONOTOUCH
#if MONOTOUCH || MOBILE_STATIC
[Category ("NotWorking")] // #10539
#endif
public void ClosedOverNullReferenceStaticMethod ()
@@ -1045,7 +1045,7 @@ namespace MonoTests.System
}
[Test] // #475962
#if MONOTOUCH
#if MONOTOUCH || MOBILE_STATIC
[Category ("NotWorking")] // #10539
#endif
public void ClosedOverNullReferenceInstanceMethod ()
@@ -1079,7 +1079,7 @@ namespace MonoTests.System
delegate int ByRefDelegate (ref FooStruct s, int a, int b, int c, int d);
#if MONOTOUCH
#if MONOTOUCH || MOBILE_STATIC
[Category ("NotWorking")]
#endif
[Test]
@@ -1279,7 +1279,7 @@ namespace MonoTests.System
{
string retarg (string s);
}
#if !MONOTOUCH
#if !MONOTOUCH && !MOBILE_STATIC
[Test]
public void CreateDelegateWithLdFtnAndAbstractMethod ()
{
@@ -1388,7 +1388,7 @@ namespace MonoTests.System
Assert.IsTrue (d (0, 0));
}
#if !MONOTOUCH
#if !MONOTOUCH && !MOBILE_STATIC
public static void DynInvokeWithClosedFirstArg (object a, object b)
{
}
@@ -1424,6 +1424,27 @@ namespace MonoTests.System
}
#endif
public delegate void DoExecuteDelegate1 (C c);
public delegate void DoExecuteDelegate2 (C c);
[Test]
[ExpectedException (typeof (ArgumentException))]
public void DelegateCombineDifferentTypes () {
var b = new B ();
var del1 = new DoExecuteDelegate1 (b.DoExecute);
var del2 = new DoExecuteDelegate2 (b.DoExecute);
var del = Delegate.Combine (del1, del2);
}
[Test]
[ExpectedException (typeof (ArgumentException))]
public void DelegateRemoveDifferentTypes () {
var b = new B ();
var del1 = new DoExecuteDelegate1 (b.DoExecute);
var del2 = new DoExecuteDelegate2 (b.DoExecute);
var del = Delegate.Remove (del1, del2);
}
static bool Int32D2 (int x, int y)
{
return (x & y) == y;

View File

@@ -156,9 +156,13 @@ namespace MonoTests.System
public void GetCommandLineArgs ()
{
string[] args = Environment.GetCommandLineArgs ();
#if !__WATCHOS__
Assert.IsNotNull (args, "not null");
Assert.IsTrue (((args.Length > 0) && (args.Length < 256)), "reasonable");
Assert.IsNotNull (args [0], "application");
#else
Assert.AreEqual (0, args.Length, "length");
#endif
}
#if !NET_2_1

View File

@@ -1 +1 @@
a45c7ec198cb62b2fb068a2a13b743b86f535288
be5e7984757b64a30bba3b7274a9f86edfab970f

View File

@@ -782,6 +782,17 @@ namespace MonoTests.System
var timeZones = (global::System.Collections.ObjectModel.ReadOnlyCollection<TimeZoneInfo>) method.Invoke (null, null);
Assert.IsTrue (timeZones.Count > 0, "GetSystemTimeZones should not return an empty collection.");
}
#if !MOBILE
[Test]
public void WindowsRegistryTimezoneWithParentheses ()
{
var method = (MethodInfo) typeof (TimeZoneInfo).GetMember ("TrimSpecial", MemberTypes.Method, BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic)[0];
var name = method.Invoke (null, new object [] { " <---> Central Standard Time (Mexico) ||<<>>" });
Assert.AreEqual (name, "Central Standard Time (Mexico)", "#1");
}
#endif
}
[TestFixture]
@@ -912,18 +923,18 @@ namespace MonoTests.System
"Canada/Newfoundland",
"Europe/Moscow",
"Europe/Riga",
"N/A", // testing that the test doesn't fail with inexistent TZs
};
foreach (var tz in subMinuteDSTs) {
try {
TimeZoneInfo.FindSystemTimeZoneById (tz);
} catch (TimeZoneNotFoundException) {
// ok;
} catch (Exception ex) {
Assert.Fail (string.Format ("Failed to load TZ {0}: {1}", tz, ex.ToString ()));
}
TimeZoneInfo.FindSystemTimeZoneById (tz);
}
}
[Test]
[ExpectedException (typeof (TimeZoneNotFoundException))]
public void InvalidName ()
{
TimeZoneInfo.FindSystemTimeZoneById ("N/A");
}
}
[TestFixture]
@@ -1121,7 +1132,49 @@ namespace MonoTests.System
Assert.AreEqual(baseUtcOffset, cairo.GetUtcOffset (d));
Assert.AreEqual(baseUtcOffset, cairo.GetUtcOffset (d.Add (new TimeSpan(0,0,0, 1))));
}
}
[Test]
public void GetUtcOffset_FromDateTimeOffset ()
{
DateTimeOffset offset;
offset = new DateTimeOffset(dst1Start, baseUtcOffset);
Assert.AreEqual(baseUtcOffset, cairo.GetUtcOffset(offset.Add(new TimeSpan(0, 0, 0, -1))), "dst1Start_with_baseUtcOffset#before");
Assert.AreEqual(dstUtcOffset, cairo.GetUtcOffset(offset), "dst1Start_with_baseUtcOffset#exact");
Assert.AreEqual(dstUtcOffset, cairo.GetUtcOffset(offset.Add(new TimeSpan(0, 0, 0, 1))), "dst1Start_with_baseUtcOffset#after");
offset = new DateTimeOffset(dst1End, dstOffset + baseUtcOffset);
Assert.AreEqual(dstUtcOffset, cairo.GetUtcOffset(offset.Add(new TimeSpan(0, 0, 0, -1))), "dst1End_with_dstOffset+baseUtcOffset#before");
Assert.AreEqual(baseUtcOffset, cairo.GetUtcOffset(offset), "dst1End_with_dstOffset+baseUtcOffset#exact");
Assert.AreEqual(baseUtcOffset, cairo.GetUtcOffset(offset.Add(new TimeSpan(0, 0, 0, 1))), "dst1End_with_dstOffset+baseUtcOffset#after");
offset = new DateTimeOffset(dst2Start, baseUtcOffset);
Assert.AreEqual(baseUtcOffset, cairo.GetUtcOffset(offset.Add(new TimeSpan(0, 0, 0, -1))), "dst2Start_with_baseUtcOffset#before");
Assert.AreEqual(dstUtcOffset, cairo.GetUtcOffset(offset), "dst2Start_with_baseUtcOffset#exact");
Assert.AreEqual(dstUtcOffset, cairo.GetUtcOffset(offset.Add(new TimeSpan(0, 0, 0, 1))), "dst2Start_with_baseUtcOffset#after");
offset = new DateTimeOffset(dst2End, baseUtcOffset + dstOffset);
Assert.AreEqual(dstUtcOffset, cairo.GetUtcOffset(offset.Add(new TimeSpan(0, 0, 0, -1))), "dst2End_with_dstOffset+baseUtcOffset#before");
Assert.AreEqual(baseUtcOffset, cairo.GetUtcOffset(offset), "dst2End_with_dstOffset+baseUtcOffset#exact");
Assert.AreEqual(baseUtcOffset, cairo.GetUtcOffset(offset.Add(new TimeSpan(0, 0, 0, 1))), "dst2End_with_dstOffset+baseUtcOffset#after");
}
[Test]
public void DTS_WithMinimalDate ()
{
TimeZoneInfo.TransitionTime startTransition, endTransition;
startTransition = TimeZoneInfo.TransitionTime.CreateFloatingDateRule (new DateTime (1, 1, 1, 4, 0, 0),
10, 2, DayOfWeek.Sunday);
endTransition = TimeZoneInfo.TransitionTime.CreateFloatingDateRule (new DateTime (1, 1, 1, 3, 0, 0),
3, 2, DayOfWeek.Sunday);
var ctz = TimeZoneInfo.CreateCustomTimeZone ("test", TimeSpan.FromHours (-5), "display", "sdisplay", "dst", new [] {
TimeZoneInfo.AdjustmentRule.CreateAdjustmentRule (DateTime.MinValue, DateTime.MaxValue.Date, TimeSpan.FromHours (-1), startTransition, endTransition) });
var offset = ctz.GetUtcOffset (DateTime.MinValue);
Assert.AreEqual (TimeSpan.FromHours (-5), offset); // TODO: Wrong it should be -6
}
}
[TestFixture]
public class GetDaylightChanges

View File

@@ -326,6 +326,16 @@ public class TimeZoneTest {
Assert.IsTrue (tzi.SupportsDaylightSavingTime, "SupportsDaylightSavingTime");
}
[Test]
public void OldEraToLocalTime ()
{
TimeSpan offset = TimeSpan.Zero;
var dto = new DateTimeOffset (new DateTime (1900, 1, 1).Ticks, offset);
// Should never throw
dto.ToLocalTime ();
}
#if MOBILE
// On device we cannot read the OS file system to look for /etc/localtime
// and /usr/share/zoneinfo - so we must initialize the BCL TimeZoneInfo
@@ -349,12 +359,15 @@ public class TimeZoneTest {
// now it fails on Snow Leopard the same way (incomplete data) with iOS5 simulator (OS update ?)
// but it *never*ever* failed on devices
incomplete_data_on_simulator_only_bug = true;
#if XAMCORE_2_0 || MONOTOUCH
#if XAMCORE_2_0
if (ObjCRuntime.Runtime.Arch == ObjCRuntime.Arch.SIMULATOR)
#else
#elif MONOTOUCH
if (MonoTouch.ObjCRuntime.Runtime.Arch == MonoTouch.ObjCRuntime.Arch.SIMULATOR)
#endif
Assert.Ignore ("known to fail on some iOS simulator versions - see source comments");
#endif // XAMCORE_2_0 || MONOTOUCH
}
}
#endif

View File

@@ -1 +1 @@
3f2d6283fb73256107a13090b14da77a1c945496
1e38f069af2b809045fa4e4cb2b686d035553a3f

View File

@@ -49,5 +49,17 @@ namespace MonoTests.System {
Assert.AreEqual (UInt64.MinValue, (ulong) pmin, "Min");
}
}
[Test]
public void ToString ()
{
// for 64 bits machines
if (UIntPtr.Size > 4) {
Assert.AreEqual (UInt64.MaxValue.ToString (), new UIntPtr (UInt64.MaxValue).ToString (), "#1");
}
else {
Assert.AreEqual (UInt32.MaxValue.ToString (), new UIntPtr (UInt32.MaxValue).ToString (), "#2");
}
}
}
}