From d873a06e41e2ea1400ff4fec9ebd2b47d802a37f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexander=20K=C3=B6plinger?= Date: Tue, 19 Dec 2023 16:21:52 +0100 Subject: [PATCH] Fix culture-dependent ToString in illink tests (#96172) We should be emitting the double/float string using invariant culture to avoid failures like this on cultures where decimal point is comma: ``` Expected: ldc.r8 2.5 ret Actual: ldc.r8 2,5 ret ``` --- .../Mono.Linker.Tests/TestCasesRunner/AssemblyChecker.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/tools/illink/test/Mono.Linker.Tests/TestCasesRunner/AssemblyChecker.cs b/src/tools/illink/test/Mono.Linker.Tests/TestCasesRunner/AssemblyChecker.cs index 8cec5a657dd42..36031245d5191 100644 --- a/src/tools/illink/test/Mono.Linker.Tests/TestCasesRunner/AssemblyChecker.cs +++ b/src/tools/illink/test/Mono.Linker.Tests/TestCasesRunner/AssemblyChecker.cs @@ -3,6 +3,7 @@ using System; using System.Collections.Generic; +using System.Globalization; using System.Linq; using System.Text; using Mono.Cecil; @@ -628,13 +629,13 @@ static string FormatInstruction (Instruction instr) case Code.Ldc_R4: if (instr.Operand is float fvalue) - return $"{instr.OpCode.ToString ()} {fvalue.ToString ()}"; + return $"{instr.OpCode.ToString ()} {fvalue.ToString (CultureInfo.InvariantCulture)}"; throw new NotImplementedException (instr.Operand.GetType ().ToString ()); case Code.Ldc_R8: if (instr.Operand is double dvalue) - return $"{instr.OpCode.ToString ()} {dvalue.ToString ()}"; + return $"{instr.OpCode.ToString ()} {dvalue.ToString (CultureInfo.InvariantCulture)}"; throw new NotImplementedException (instr.Operand.GetType ().ToString ());