You've already forked linux-packaging-mono
Imported Upstream version 4.2.1.36
Former-commit-id: f3008ca867fe7e4b7ae9b9a8844c0ad5798925a9
This commit is contained in:
committed by
Jo Shields
parent
afe402035c
commit
ea5caba957
@@ -816,8 +816,15 @@ namespace System.Globalization
|
||||
CultureInfo ci = new CultureInfo ();
|
||||
|
||||
if (!ci.construct_internal_locale_from_name (name)) {
|
||||
int idx = name.IndexOf ('-');
|
||||
if (idx < 1 || !ci.construct_internal_locale_from_name (name.Substring (0, idx)))
|
||||
int idx = name.Length - 1;
|
||||
if (idx > 0) {
|
||||
while ((idx = name.LastIndexOf ('-', idx - 1)) > 0) {
|
||||
if (ci.construct_internal_locale_from_name (name.Substring (0, idx)))
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (idx <= 0)
|
||||
throw CreateNotFoundException (src_name);
|
||||
}
|
||||
|
||||
|
@@ -870,12 +870,12 @@ namespace System
|
||||
}
|
||||
|
||||
// DaylightTime.Start is relative to the Standard time.
|
||||
if (start != DateTime.MinValue)
|
||||
start += BaseUtcOffset;
|
||||
if (!TryAddTicks (start, BaseUtcOffset.Ticks, out start))
|
||||
start = DateTime.MinValue;
|
||||
|
||||
// DaylightTime.End is relative to the DST time.
|
||||
if (end != DateTime.MinValue)
|
||||
end += BaseUtcOffset + delta;
|
||||
if (!TryAddTicks (end, BaseUtcOffset.Ticks + delta.Ticks, out end))
|
||||
end = DateTime.MinValue;
|
||||
} else {
|
||||
AdjustmentRule first = null, last = null;
|
||||
|
||||
|
@@ -171,6 +171,21 @@ namespace MonoTests.System.Globalization
|
||||
|
||||
ci = CultureInfo.CreateSpecificCulture ("");
|
||||
Assert.AreEqual (CultureInfo.InvariantCulture, ci, "#5");
|
||||
|
||||
ci = CultureInfo.CreateSpecificCulture ("zh-hant");
|
||||
Assert.AreEqual ("zh-HK", ci.Name, "#6");
|
||||
|
||||
ci = CultureInfo.CreateSpecificCulture ("zh-hans");
|
||||
Assert.AreEqual ("zh-CN", ci.Name, "#7");
|
||||
|
||||
ci = CultureInfo.CreateSpecificCulture ("zh-hans-CN");
|
||||
Assert.AreEqual ("zh-CN", ci.Name, "#8");
|
||||
|
||||
ci = CultureInfo.CreateSpecificCulture ("zh-hant-US");
|
||||
Assert.AreEqual ("zh-HK", ci.Name, "#9");
|
||||
|
||||
ci = CultureInfo.CreateSpecificCulture ("az-CyrlM-BR");
|
||||
Assert.AreEqual ("az-Latn-AZ", ci.Name, "#10");
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
@@ -232,6 +232,7 @@ namespace MonoTests.System
|
||||
|
||||
[Test]
|
||||
[ExpectedException (typeof (ArgumentOutOfRangeException))]
|
||||
[Category("MobileNotWorking")]
|
||||
public void AddHoursOutOfRangeException1 ()
|
||||
{
|
||||
DateTime t1 = new DateTime (myTicks [1]);
|
||||
@@ -240,6 +241,7 @@ namespace MonoTests.System
|
||||
|
||||
[Test]
|
||||
[ExpectedException (typeof (ArgumentOutOfRangeException))]
|
||||
[Category("MobileNotWorking")]
|
||||
public void AddHoursOutOfRangeException2 ()
|
||||
{
|
||||
DateTime t1 = new DateTime (myTicks [1]);
|
||||
|
@@ -1062,6 +1062,19 @@ namespace MonoTests.System
|
||||
Assert.AreEqual (new DateTime (2014, 10, 5, 2, 0, 0), changes.Start);
|
||||
Assert.AreEqual (new DateTime (2014, 4, 6, 3, 0, 0), changes.End);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void AllTimeZonesDaylightChanges ()
|
||||
{
|
||||
foreach (var tz in TimeZoneInfo.GetSystemTimeZones ()) {
|
||||
try {
|
||||
for (var year = 1950; year <= DateTime.Now.Year; year++)
|
||||
getChanges.Invoke (tz, new object [] {year} );
|
||||
} catch (Exception e) {
|
||||
Assert.Fail ("TimeZone " + tz.Id + " exception: " + e.ToString ());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user