Imported Upstream version 6.4.0.137

Former-commit-id: 943baa9f16a098c33e129777827f3a9d20da00d6
This commit is contained in:
Xamarin Public Jenkins (auto-signing)
2019-07-26 19:53:28 +00:00
parent e9207cf623
commit ef583813eb
2712 changed files with 74169 additions and 40587 deletions

View File

@@ -17,8 +17,10 @@ using System.Reflection;
using System.Reflection.Emit;
#endif
using System.Runtime.InteropServices;
#if !DISABLE_REMOTING
using System.Runtime.Remoting;
using System.Runtime.Remoting.Channels;
#endif
using System.Security;
using System.Security.Permissions;
@@ -273,6 +275,7 @@ namespace MonoTests.System {
Activator.CreateInstance (new CustomUserType ());
}
#if !DISABLE_REMOTING
[Test]
public void CreateInstance_StringString ()
{
@@ -281,6 +284,7 @@ namespace MonoTests.System {
objCOMTest.Id = 2;
Assert.AreEqual (2, objCOMTest.Id, "#A03");
}
#endif
[Test]
[ExpectedException (typeof (ArgumentNullException))]
@@ -422,6 +426,7 @@ namespace MonoTests.System {
// TODO: Implemente the test methods for all the overriden function using activationAttribute
#if !DISABLE_REMOTING
[Test]
[Category ("AndroidNotWorking")] // Assemblies aren't accessible using filesystem paths (they're either in apk, embedded in native code or not there at all
public void CreateInstanceFrom ()
@@ -431,6 +436,7 @@ namespace MonoTests.System {
objHandle.Unwrap ();
// TODO: Implement the test methods for all the overriden function using activationAttribute
}
#endif
#if !MOBILE
@@ -505,6 +511,7 @@ namespace MonoTests.System {
Assert.IsNotNull (Activator.CreateInstance (typeof (foo2<long, int>)), "foo2<long, int>");
}
#if !DISABLE_REMOTING
[Test]
public void CreateInstanceCrossDomain ()
{
@@ -513,8 +520,9 @@ namespace MonoTests.System {
BindingFlags.Public | BindingFlags.Instance, null, null, CultureInfo.InvariantCulture,
null, null);
}
#endif
#if !MONOTOUCH && !FULL_AOT_RUNTIME
#if !MONOTOUCH && !FULL_AOT_RUNTIME && !DISABLE_REMOTING
[Test]
public void CreateInstanceCustomDomain ()
{
@@ -524,6 +532,8 @@ namespace MonoTests.System {
null, null);
}
#endif
#if !DISABLE_REMOTING
[Test]
public void CreateInstanceCrossDomainNonSerializableArgs ()
{
@@ -531,6 +541,7 @@ namespace MonoTests.System {
Activator.CreateInstance (AppDomain.CurrentDomain, "mscorlib.dll", "System.WeakReference", false,
BindingFlags.Public | BindingFlags.Instance, null, new object [] {ModuleHandle.EmptyHandle}, null, null, null);
}
#endif
[Test]
[ExpectedException (typeof (NotSupportedException))]

View File

@@ -110,6 +110,7 @@ namespace MonoTests.System {
}
[Test]
[Category ("Calendars")]
public void ParameterlessToString ()
{
DateTimeOffset dt = new DateTimeOffset (2007, 12, 18, 12, 16, 30, new TimeSpan (1, 0, 0));
@@ -121,6 +122,7 @@ namespace MonoTests.System {
}
[Test]
[Category ("Calendars")]
public void ToStringWithCultureInfo ()
{
DateTimeOffset dto = new DateTimeOffset(2007, 5, 1, 9, 0, 0, TimeSpan.Zero);
@@ -146,6 +148,7 @@ namespace MonoTests.System {
}
[Test]
[Category ("Calendars")]
public void ToStringWithFormat ()
{
DateTimeOffset dto = new DateTimeOffset (2007, 10, 31, 21, 0, 0, new TimeSpan(-8, 0, 0));
@@ -173,8 +176,10 @@ namespace MonoTests.System {
DateTimeOffset dto = new DateTimeOffset (2007, 11, 1, 9, 0, 0, new TimeSpan(-7, 0, 0));
const string format = "dddd, MMM dd yyyy HH:mm:ss zzz";
Assert.AreEqual ("Thursday, Nov 01 2007 09:00:00 -07:00", dto.ToString (format, CultureInfo.InvariantCulture), "ts2");
Assert.AreEqual ("jeudi, nov. 01 2007 09:00:00 -07:00", dto.ToString (format, new CultureInfo ("fr-FR")), "ts3");
Assert.AreEqual ("jueves, nov. 01 2007 09:00:00 -07:00", dto.ToString (format, new CultureInfo ("es-ES")), "ts4");
if (!GlobalizationMode.Invariant) {
Assert.AreEqual ("jeudi, nov. 01 2007 09:00:00 -07:00", dto.ToString (format, new CultureInfo ("fr-FR")), "ts3");
Assert.AreEqual ("jueves, nov. 01 2007 09:00:00 -07:00", dto.ToString (format, new CultureInfo ("es-ES")), "ts4");
}
}
[Test]
@@ -251,6 +256,7 @@ namespace MonoTests.System {
// see bug 589227
//
[Test]
[Category ("Calendars")]
public void ParseExactWithKFormat ()
{
DateTimeOffset o = DateTimeOffset.ParseExact ("Wed Mar 17 22:25:08 +0000 2010", "ddd MMM d H:m:ss K yyyy", CultureInfo.InvariantCulture);

View File

@@ -364,6 +364,7 @@ namespace MonoTests.System
}
[Test]
[Category ("Calendars")]
public void TestToStringGenitive ()
{
DateTime dt = new DateTime (2010, 1, 2, 3, 4, 5);
@@ -1134,6 +1135,7 @@ namespace MonoTests.System
}
[Test]
[Category ("Calendars")]
public void TestParseWithDifferentMonthDayPatterns ()
{
CultureInfo cultureInfo = new CultureInfo("en-US");
@@ -1175,16 +1177,19 @@ namespace MonoTests.System
{
string s = "Wednesday, 09 June 2004";
DateTime.ParseExact (s, "dddd, dd MMMM yyyy", CultureInfo.InvariantCulture);
try {
DateTime.ParseExact (s, "dddd, dd MMMM yyyy", new CultureInfo ("ja-JP"));
Assert.Fail ("ja-JP culture does not support format \"dddd, dd MMMM yyyy\"");
} catch (FormatException) {
if (!GlobalizationMode.Invariant) {
try {
DateTime.ParseExact (s, "dddd, dd MMMM yyyy", new CultureInfo ("ja-JP"));
Assert.Fail ("ja-JP culture does not support format \"dddd, dd MMMM yyyy\"");
} catch (FormatException) {
}
}
// Ok, now we can assume ParseExact() works expectedly.
DateTime.Parse (s, CultureInfo.InvariantCulture, DateTimeStyles.AllowWhiteSpaces);
DateTime.Parse (s, new CultureInfo ("ja-JP"), DateTimeStyles.AllowWhiteSpaces);
if (!GlobalizationMode.Invariant)
DateTime.Parse (s, new CultureInfo ("ja-JP"), DateTimeStyles.AllowWhiteSpaces);
//DateTime.Parse (s, null); currently am not sure if it works for _every_ culture.
}
@@ -1242,6 +1247,7 @@ namespace MonoTests.System
}
[Test] // bug #72788
[Category ("Calendars")]
public void Parse_Bug72788 ()
{
DateTime dt = DateTime.Parse ("21/02/05", new CultureInfo ("fr-FR"));
@@ -1276,6 +1282,7 @@ namespace MonoTests.System
}
[Test]
[Category ("Calendars")]
public void Parse_Bug53023b ()
{
foreach (CultureInfo ci in CultureInfo.GetCultures (CultureTypes.SpecificCultures)) {
@@ -1297,6 +1304,7 @@ namespace MonoTests.System
}
[Test]
[Category ("Calendars")]
public void Parse_SameTimeAndDateSeparator ()
{
var fiFI = (CultureInfo) CultureInfo.GetCultureInfo("fi-FI").Clone();
@@ -1341,6 +1349,7 @@ namespace MonoTests.System
}
[Test]
[Category ("Calendars")]
public void ParseCOMDependentFormat ()
{
// Japanese format.
@@ -1359,6 +1368,7 @@ namespace MonoTests.System
}
[Test]
[Category ("Calendars")]
[ExpectedException(typeof (FormatException))]
public void ParseFormatException1 ()
{
@@ -1399,6 +1409,7 @@ namespace MonoTests.System
}
[Test]
[Category ("Calendars")]
public void ParseUtcNonUtc ()
{
Thread.CurrentThread.CurrentCulture = new CultureInfo ("es-ES");
@@ -1463,6 +1474,7 @@ namespace MonoTests.System
}
[Test]
[Category ("Calendars")]
public void TimeZoneAdjustment ()
{
CultureInfo ci = Thread.CurrentThread.CurrentCulture;
@@ -1851,6 +1863,7 @@ namespace MonoTests.System
}
[Test]
[Category ("Calendars")]
public void ParseExact_Bug80094 ()
{
// we can safely change the curernt culture, as the original value will
@@ -2584,6 +2597,7 @@ namespace MonoTests.System
}
[Test]
[Category ("Calendars")]
public void GenitiveMonth ()
{
var ci = new CultureInfo ("ru-RU");
@@ -2592,6 +2606,7 @@ namespace MonoTests.System
}
[Test]
[Category ("Calendars")]
public void Parse_ThaiCalendar ()
{
var culture = CultureInfo.GetCultureInfo ("th-TH");
@@ -2670,6 +2685,7 @@ namespace MonoTests.System
}
[Test] // https://github.com/mono/mono/issues/11317
[Category ("Calendars")]
public void DateTimeKoCulture ()
{
foreach (var culture in new [] { new CultureInfo ("ko"), new CultureInfo ("ko-KR") })

View File

@@ -1 +1 @@
02eacf31cdf3198ab2430b3f31ae5ab17acfb7f8
3d3aeeb40f0c0834bd9616ab9cf4cd5c8ae579d6

View File

@@ -407,21 +407,21 @@ namespace MonoTests.System
}
#if !MOBILE
void NestedStackTraces (int depth)
void NestedStackTraces (int depth)
{
if (depth == 0)
throw new ArgumentException ("Depth 0 exception");
if (depth == 0)
throw new ArgumentException ("Depth 0 exception");
try {
NestedStackTraces (depth - 1);
} catch (Exception exc) {
throw new Exception (String.Format ("Depth {0} exception, expect nested", depth), exc);
}
}
void StacktraceToStateTest (int depth)
{
try {
NestedStackTraces (depth);
NestedStackTraces (depth - 1);
} catch (Exception exc) {
throw new Exception (String.Format ("Depth {0} exception, expect nested", depth), exc);
}
}
void StacktraceToStateTest (int depth)
{
try {
NestedStackTraces (depth);
} catch (Exception exc) {
var monoType = Type.GetType ("Mono.Runtime", false);
var convert = monoType.GetMethod("ExceptionToState", BindingFlags.NonPublic | BindingFlags.Static);
@@ -432,41 +432,41 @@ namespace MonoTests.System
var portable_hash = output.Item2;
var unportable_hash = output.Item3;
// To see what we're working with
// Console.WriteLine (dump);
// To see what we're working with
// Console.WriteLine (dump);
Assert.IsTrue (portable_hash != 0, "#1");
Assert.IsTrue (unportable_hash != 0, "#2");
Assert.IsTrue (dump.Length > 0, "#3");
}
}
// Ensure that we can convert a stacktrace to a
// telemetry message
//
[Test]
[Category("NotOnWindows")]
public void StacktraceToStateBase ()
{
StacktraceToStateTest (0);
}
[Test]
[Category("NotOnWindows")]
public void StacktraceToStateDeeper ()
{
StacktraceToStateTest (2);
}
[Test]
[Category("NotOnWindows")]
public void StacktraceToStateOverflow ()
{
// We set a limit on 15 nested exceptions. Lets check that we're valid
// when exceeding that limit.
StacktraceToStateTest (20);
}
// Ensure that we can convert a stacktrace to a
// telemetry message
//
[Test]
[Category("NotOnWindows")]
public void StacktraceToStateBase ()
{
StacktraceToStateTest (0);
}
[Test]
[Category("NotOnWindows")]
public void StacktraceToStateDeeper ()
{
StacktraceToStateTest (2);
}
[Test]
[Category("NotOnWindows")]
public void StacktraceToStateOverflow ()
{
// We set a limit on 15 nested exceptions. Lets check that we're valid
// when exceeding that limit.
StacktraceToStateTest (20);
}
void DumpSingle ()
{
var monoType = Type.GetType ("Mono.Runtime", false);

View File

@@ -1 +1 @@
29cd9e998c4364233a67531eea5afb4eae336256
eabaa07fe124189e2be6ebda3b3e69664ea27672

View File

@@ -657,18 +657,20 @@ public class TimeSpanTest {
ParseHelper ("10:11:12:13", false, false, "10.11:12:13"); // Days using : instead of . as separator
ParseHelper ("10.11", true, false, "dontcare"); // days+hours is invalid
// Force the use of french culture -which is using a non common NumberDecimalSeparator-
// as current culture, to show that the Parse method is *actually* being culture sensitive
// *and* also keeping the compatibility with '.'
CultureInfo french_culture = CultureInfo.GetCultureInfo ("fr-FR");
CultureInfo prev_culture = CultureInfo.CurrentCulture;
try {
Thread.CurrentThread.CurrentCulture = french_culture;
ParseHelper ("10:10:10,006", false, false, "10:10:10.0060000");
ParseHelper ("10:10:10.006", false, false, "10:10:10.0060000");
} finally {
// restore culture
Thread.CurrentThread.CurrentCulture = prev_culture;
if (!GlobalizationMode.Invariant) {
// Force the use of french culture -which is using a non common NumberDecimalSeparator-
// as current culture, to show that the Parse method is *actually* being culture sensitive
// *and* also keeping the compatibility with '.'
CultureInfo french_culture = CultureInfo.GetCultureInfo ("fr-FR");
CultureInfo prev_culture = CultureInfo.CurrentCulture;
try {
Thread.CurrentThread.CurrentCulture = french_culture;
ParseHelper ("10:10:10,006", false, false, "10:10:10.0060000");
ParseHelper ("10:10:10.006", false, false, "10:10:10.0060000");
} finally {
// restore culture
Thread.CurrentThread.CurrentCulture = prev_culture;
}
}
ParseHelper ("00:00:00", false, false, "00:00:00");
@@ -812,18 +814,20 @@ public class TimeSpanTest {
Assert.AreEqual (true, TimeSpan.TryParse ("-10675199.02:48:05.4775808", out result), "MinValue#1");
Assert.AreEqual (TimeSpan.MinValue, result, "MinValue#2");
// Force the use of french culture -which is using a non common NumberDecimalSeparator-
// as current culture, to show that the Parse method is *actually* being culture sensitive
CultureInfo french_culture = CultureInfo.GetCultureInfo ("fr-FR");
CultureInfo prev_culture = CultureInfo.CurrentCulture;
result = new TimeSpan (0, 10, 10, 10, 6);
try {
Thread.CurrentThread.CurrentCulture = french_culture;
Assert.AreEqual (true, TimeSpan.TryParse ("10:10:10,006", out result), "#CultureSensitive1");
Assert.AreEqual ("10:10:10.0060000", result.ToString (), "#CultureSensitive2");
} finally {
// restore culture
Thread.CurrentThread.CurrentCulture = prev_culture;
if (!GlobalizationMode.Invariant) {
// Force the use of french culture -which is using a non common NumberDecimalSeparator-
// as current culture, to show that the Parse method is *actually* being culture sensitive
CultureInfo french_culture = CultureInfo.GetCultureInfo ("fr-FR");
CultureInfo prev_culture = CultureInfo.CurrentCulture;
result = new TimeSpan (0, 10, 10, 10, 6);
try {
Thread.CurrentThread.CurrentCulture = french_culture;
Assert.AreEqual (true, TimeSpan.TryParse ("10:10:10,006", out result), "#CultureSensitive1");
Assert.AreEqual ("10:10:10.0060000", result.ToString (), "#CultureSensitive2");
} finally {
// restore culture
Thread.CurrentThread.CurrentCulture = prev_culture;
}
}
}
@@ -842,10 +846,12 @@ public class TimeSpanTest {
{
TimeSpan result;
// We use fr-FR culture since its NumericDecimalSeparator is not the same used by
// most cultures - including the invariant one.
CultureInfo french_culture = CultureInfo.GetCultureInfo ("fr-FR");
Assert.AreEqual (true, TimeSpan.TryParse ("11:50:50,006", french_culture, out result), "#A1");
if (!GlobalizationMode.Invariant) {
// We use fr-FR culture since its NumericDecimalSeparator is not the same used by
// most cultures - including the invariant one.
CultureInfo french_culture = CultureInfo.GetCultureInfo ("fr-FR");
Assert.AreEqual (true, TimeSpan.TryParse ("11:50:50,006", french_culture, out result), "#A1");
}
// LAMESPEC - msdn states that an instance of DateTimeFormatInfo is retrieved to
// obtain culture sensitive information, but at least in the betas that's false
@@ -858,9 +864,6 @@ public class TimeSpanTest {
[Test]
public void ParseExact ()
{
CultureInfo french_culture = CultureInfo.GetCultureInfo ("fr-FR");
CultureInfo us_culture = CultureInfo.GetCultureInfo ("en-US");
// At this point we are only missing the style bites and then we are
// pretty much done with the standard formats.
@@ -876,17 +879,22 @@ public class TimeSpanTest {
ParseExactHelper ("11:12:13", g_format, false, false, "11:12:13");
ParseExactHelper ("-11:12:13", g_format, false, false, "-11:12:13");
ParseExactHelper ("10.11:12:13", g_format, true, false, "dontcare"); // this should work as well
ParseExactHelper ("10.11:12:13", g_format, true, false, "dontcare", us_culture);
ParseExactHelper ("10.11:12:13", g_format, true, false, "dontcare", CultureInfo.InvariantCulture);
ParseExactHelper ("10:11:12:66", g_format, true, false, "dontcare");
ParseExactHelper ("10:11:12:13", g_format, false, false, "10.11:12:13");
ParseExactHelper ("11:12:13.6", g_format, false, false, "11:12:13.6000000", CultureInfo.InvariantCulture);
ParseExactHelper ("11:12:13,6", g_format, false, false, "11:12:13.6000000", french_culture);
ParseExactHelper ("10:11:12:13.6", g_format, false, false, "10.11:12:13.6000000", us_culture);
ParseExactHelper (" 10:11:12:13.6 ", g_format, false, false, "10.11:12:13.6000000", us_culture);
ParseExactHelper ("10:11", g_format, false, false, "10:11:00", null, TimeSpanStyles.None);
ParseExactHelper ("10:11", g_format, false, false, "10:11:00", null, TimeSpanStyles.AssumeNegative); // no effect
if (!GlobalizationMode.Invariant) {
CultureInfo french_culture = CultureInfo.GetCultureInfo ("fr-FR");
CultureInfo us_culture = CultureInfo.GetCultureInfo ("en-US");
ParseExactHelper ("10.11:12:13", g_format, true, false, "dontcare", us_culture);
ParseExactHelper ("11:12:13,6", g_format, false, false, "11:12:13.6000000", french_culture);
ParseExactHelper ("10:11:12:13.6", g_format, false, false, "10.11:12:13.6000000", us_culture);
ParseExactHelper (" 10:11:12:13.6 ", g_format, false, false, "10.11:12:13.6000000", us_culture);
}
//
// G format
//
@@ -895,15 +903,20 @@ public class TimeSpanTest {
ParseExactHelper ("9:10:12.6", G_format, true, false, "dontcare");
ParseExactHelper ("3.9:10:12", G_format, true, false, "dontcare");
ParseExactHelper ("3.9:10:12.153", G_format, true, false, "dontcare"); // this should be valid...
ParseExactHelper ("3:9:10:12.153", G_format, false, false, "3.09:10:12.1530000", us_culture);
ParseExactHelper ("0:9:10:12.153", G_format, false, false, "09:10:12.1530000", us_culture);
ParseExactHelper ("03:09:10:12.153", G_format, false, false, "3.09:10:12.1530000", us_culture);
ParseExactHelper ("003:009:0010:0012.00153", G_format, false, false, "3.09:10:12.0015300", us_culture);
ParseExactHelper ("3:9:10:66.153", G_format, true, false, "dontcare"); // seconds out of range
ParseExactHelper ("3:9:10:12.153", G_format, true, false, "dontcare", french_culture); // fr-FR uses ',' as decimal separator
ParseExactHelper ("3:9:10:12,153", G_format, false, false, "3.09:10:12.1530000", french_culture);
ParseExactHelper (" 3:9:10:12.153 ", G_format, false, false, "3.09:10:12.1530000", us_culture);
ParseExactHelper ("3:9:10:13.153", G_format, false, false, "3.09:10:13.1530000", us_culture, TimeSpanStyles.AssumeNegative);
if (!GlobalizationMode.Invariant) {
CultureInfo french_culture = CultureInfo.GetCultureInfo ("fr-FR");
CultureInfo us_culture = CultureInfo.GetCultureInfo ("en-US");
ParseExactHelper ("3:9:10:12.153", G_format, false, false, "3.09:10:12.1530000", us_culture);
ParseExactHelper ("0:9:10:12.153", G_format, false, false, "09:10:12.1530000", us_culture);
ParseExactHelper ("03:09:10:12.153", G_format, false, false, "3.09:10:12.1530000", us_culture);
ParseExactHelper ("003:009:0010:0012.00153", G_format, false, false, "3.09:10:12.0015300", us_culture);
ParseExactHelper ("3:9:10:12.153", G_format, true, false, "dontcare", french_culture); // fr-FR uses ',' as decimal separator
ParseExactHelper ("3:9:10:12,153", G_format, false, false, "3.09:10:12.1530000", french_culture);
ParseExactHelper (" 3:9:10:12.153 ", G_format, false, false, "3.09:10:12.1530000", us_culture);
ParseExactHelper ("3:9:10:13.153", G_format, false, false, "3.09:10:13.1530000", us_culture, TimeSpanStyles.AssumeNegative);
}
// c format
string [] c_format = new string [] { "c" };
@@ -915,7 +928,6 @@ public class TimeSpanTest {
ParseExactHelper ("10:11:12:13", c_format, true, false, "dontcare"); // this is normally accepted in the Parse method
ParseExactHelper ("10.11:12:13.6", c_format, false, false, "10.11:12:13.6000000");
ParseExactHelper ("10:11:12,6", c_format, true, false, "dontcare");
ParseExactHelper ("10:11:12,6", c_format, true, false, "dontcare", french_culture);
ParseExactHelper (" 10:11:12.6 ", c_format, false, false, "10:11:12.6000000");
ParseExactHelper ("10:12", c_format, false, false, "10:12:00", null, TimeSpanStyles.AssumeNegative);
ParseExactHelper ("10:123456789999", c_format, true, false, "dontcare");
@@ -923,6 +935,11 @@ public class TimeSpanTest {
ParseExactHelper ("10:12", new string [0], true, false, "dontcare");
ParseExactHelper ("10:12", new string [] { String.Empty }, true, false, "dontcare");
ParseExactHelper ("10:12", new string [] { null }, true, false, "dontcare");
if (!GlobalizationMode.Invariant) {
CultureInfo french_culture = CultureInfo.GetCultureInfo ("fr-FR");
ParseExactHelper ("10:11:12,6", c_format, true, false, "dontcare", french_culture);
}
}
[Test]
@@ -1072,6 +1089,7 @@ public class TimeSpanTest {
// 'Ported' the ParseExact test to use TryParseExact instead.
[Test]
[Category ("Calendars")]
public void TryParseExact ()
{
CultureInfo french_culture = CultureInfo.GetCultureInfo ("fr-FR");
@@ -1185,21 +1203,23 @@ public class TimeSpanTest {
Assert.AreEqual ("1.02:03:04.0060000", ts.ToString (null), "#A3");
Assert.AreEqual ("1.02:03:04.0060000", ts.ToString (String.Empty), "#A4");
//
// IFormatProvider ones - use a culture changing numeric format.
// Also, we use fr-FR as culture, since it uses some elements different to invariant culture
//
CultureInfo culture = CultureInfo.GetCultureInfo ("fr-FR");
if (!GlobalizationMode.Invariant) {
//
// IFormatProvider ones - use a culture changing numeric format.
// Also, we use fr-FR as culture, since it uses some elements different to invariant culture
//
CultureInfo culture = CultureInfo.GetCultureInfo ("fr-FR");
Assert.AreEqual ("1:2:03:04,006", ts.ToString ("g", culture), "#B1");
Assert.AreEqual ("1:02:03:04,0060000", ts.ToString ("G", culture), "#B2");
Assert.AreEqual ("1.02:03:04.0060000", ts.ToString ("c", culture), "#B3"); // 'c' format ignores CultureInfo
Assert.AreEqual ("1.02:03:04.0060000", ts.ToString ("t", culture), "#B4"); // 't' and 'T' are the same as 'c'
Assert.AreEqual("1.02:03:04.0060000", ts.ToString("T", culture), "#B5");
Assert.AreEqual ("1:2:03:04,006", ts.ToString ("g", culture), "#B1");
Assert.AreEqual ("1:02:03:04,0060000", ts.ToString ("G", culture), "#B2");
Assert.AreEqual ("1.02:03:04.0060000", ts.ToString ("c", culture), "#B3"); // 'c' format ignores CultureInfo
Assert.AreEqual ("1.02:03:04.0060000", ts.ToString ("t", culture), "#B4"); // 't' and 'T' are the same as 'c'
Assert.AreEqual("1.02:03:04.0060000", ts.ToString("T", culture), "#B5");
ts = new TimeSpan (4, 5, 6);
Assert.AreEqual ("4:05:06", ts.ToString ("g", culture), "#C1");
Assert.AreEqual ("0:04:05:06,0000000", ts.ToString ("G", culture), "#C2");
ts = new TimeSpan (4, 5, 6);
Assert.AreEqual ("4:05:06", ts.ToString ("g", culture), "#C1");
Assert.AreEqual ("0:04:05:06,0000000", ts.ToString ("G", culture), "#C2");
}
}
[Test]

View File

@@ -121,6 +121,7 @@ namespace MonoTests.System
[Test] // Covers #24958
public void LocalId ()
{
#if !MONOTOUCH && !XAMMAC
byte[] buf = new byte [512];
var path = "/etc/localtime";
@@ -131,10 +132,9 @@ namespace MonoTests.System
} catch (DllNotFoundException e) {
return;
}
#if !MONOTOUCH && !XAMMAC
// this assumption is incorrect for the TimeZoneInfo.MonoTouch.cs implementation (iOS, tvOS, watchOS and XamMac Modern)
Assert.IsTrue (TimeZoneInfo.Local.Id != "Local", "Local timezone id should not be \"Local\"");
#endif
Assert.IsTrue (TimeZoneInfo.Local.Id != "Local", "Local timezone id should not be \"Local\"");
}
}