Welcome to mirror list, hosted at ThFree Co, Russian Federation.

DateTimeTests.cs « DebuggerTestSuite « wasm « sdks - github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 1b2ff400da3d4d63bbedd9fade225ad02325bdcb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
using System;
using System.Threading.Tasks;
using Xunit;
using System.Globalization;

namespace DebuggerTests
{
	public class DateTimeList : DebuggerTestBase {

		[Theory]
		[InlineData ("en-US")]
		[InlineData ("de-DE")]
		[InlineData ("ka-GE")]
		[InlineData ("hu-HU")]
        
        // Currently not passing tests. Issue #19743
        // [InlineData ("ja-JP")]
        // [InlineData ("es-ES")]
		public async Task CheckDateTimeLocale (string locale) {
			var insp = new Inspector ();
			var scripts = SubscribeToScripts(insp);

			await Ready();
			await insp.Ready (async (cli, token) => {
				ctx = new DebugTestContext (cli, insp, token, scripts);
				var debugger_test_loc = "dotnet://debugger-test.dll/debugger-datetime-test.cs";

				await SetBreakpointInMethod ("debugger-test", "DebuggerTests.DateTimeTest", "LocaleTest", 15);
				
				var pause_location = await EvaluateAndCheck (
					"window.setTimeout(function() { invoke_static_method ('[debugger-test] DebuggerTests.DateTimeTest:LocaleTest'," 
					+ $"'{locale}'); }}, 1);",
					debugger_test_loc, 20, 3, "LocaleTest",
					locals_fn: async (locals) => {
						DateTimeFormatInfo dtfi = CultureInfo.GetCultureInfo(locale).DateTimeFormat;
						CultureInfo.CurrentCulture = new CultureInfo (locale, false);
						DateTime dt = new DateTime (2020, 1, 2, 3, 4, 5);
						string dt_str = dt.ToString();

						var fdtp = dtfi.FullDateTimePattern;
						var ldp = dtfi.LongDatePattern;
						var ltp = dtfi.LongTimePattern;
						var sdp = dtfi.ShortDatePattern;
						var stp = dtfi.ShortTimePattern;

						CheckString(locals, "fdtp", fdtp);
						CheckString(locals, "ldp", ldp);
						CheckString(locals, "ltp", ltp);
						CheckString(locals, "sdp", sdp);
						CheckString(locals, "stp", stp);
						await CheckDateTime(locals, "dt", dt);
						CheckString(locals, "dt_str", dt_str);
					}
				);
				
				
			});
		}

	}
}