Skip to content

Commit 768eb2e

Browse files
authored
Add iOS functional test for invariant culture only mode. (#49057)
Contributes to #43865 1. ./build.sh mono+libs -os iOS -arch x64 -c Release 2. ./dotnet.sh build /t:Test src/tests/FunctionalTests/iOS/Simulator/InvariantCultureOnlyMode /p:TargetOS=iOS /p:TargetArchitecture=x64 /p:Configuration=Release
1 parent 2f2614f commit 768eb2e

File tree

3 files changed

+49
-4
lines changed

3 files changed

+49
-4
lines changed

src/tasks/AppleAppBuilder/Xcode.cs

+4-4
Original file line numberDiff line numberDiff line change
@@ -120,21 +120,21 @@ public string GenerateXCode(
120120
var defines = new StringBuilder();
121121
if (forceInterpreter)
122122
{
123-
defines.Append("add_definitions(-DFORCE_INTERPRETER=1)");
123+
defines.AppendLine("add_definitions(-DFORCE_INTERPRETER=1)");
124124
}
125125
else if (forceAOT)
126126
{
127-
defines.Append("add_definitions(-DFORCE_AOT=1)");
127+
defines.AppendLine("add_definitions(-DFORCE_AOT=1)");
128128
}
129129

130130
if (invariantGlobalization)
131131
{
132-
defines.Append("add_definitions(-DINVARIANT_GLOBALIZATION=1)");
132+
defines.AppendLine("add_definitions(-DINVARIANT_GLOBALIZATION=1)");
133133
}
134134

135135
if (EnableRuntimeLogging)
136136
{
137-
defines.Append("add_definitions(-DENABLE_RUNTIME_LOGGING=1)");
137+
defines.AppendLine("add_definitions(-DENABLE_RUNTIME_LOGGING=1)");
138138
}
139139

140140
cmakeLists = cmakeLists.Replace("%Defines%", defines.ToString());
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
// Licensed to the .NET Foundation under one or more agreements.
2+
// The .NET Foundation licenses this file to you under the MIT license.
3+
4+
using System;
5+
using System.Globalization;
6+
using System.Threading;
7+
using System.Threading.Tasks;
8+
using System.Runtime.InteropServices;
9+
10+
public static class Program
11+
{
12+
[DllImport("__Internal")]
13+
public static extern void mono_ios_set_summary (string value);
14+
15+
public static async Task<int> Main(string[] args)
16+
{
17+
mono_ios_set_summary($"Starting functional test");
18+
19+
var culture = new CultureInfo("es-ES", false);
20+
// https://github.com/dotnet/runtime/blob/main/docs/design/features/globalization-invariant-mode.md#cultures-and-culture-data
21+
int result = culture.LCID == 0x1000 && culture.NativeName == "Invariant Language (Invariant Country)" ? 42 : 1;
22+
23+
Console.WriteLine("Done!");
24+
await Task.Delay(5000);
25+
26+
return result;
27+
}
28+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
<PropertyGroup>
3+
<OutputType>Exe</OutputType>
4+
<MonoForceInterpreter>true</MonoForceInterpreter>
5+
<RunAOTCompilation>false</RunAOTCompilation>
6+
<InvariantGlobalization>true</InvariantGlobalization>
7+
<TestRuntime>true</TestRuntime>
8+
<TargetFrameworks>$(NetCoreAppCurrent)</TargetFrameworks>
9+
<MainLibraryFileName>iOS.Simulator.InvariantCultureOnlyMode.Test.dll</MainLibraryFileName>
10+
<IncludesTestRunner>false</IncludesTestRunner>
11+
<ExpectedExitCode>42</ExpectedExitCode>
12+
</PropertyGroup>
13+
14+
<ItemGroup>
15+
<Compile Include="Program.cs" />
16+
</ItemGroup>
17+
</Project>

0 commit comments

Comments
 (0)