From 6fcf3b305ee899c5958afb7ef1ac9b39e9d3231f Mon Sep 17 00:00:00 2001 From: Yauheni Khnykin Date: Mon, 6 Feb 2023 16:22:52 +0100 Subject: [PATCH] Fixes unit tests on non-en localised machine --- Sources/CucumberSwift/StubGeneration/Method.swift | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Sources/CucumberSwift/StubGeneration/Method.swift b/Sources/CucumberSwift/StubGeneration/Method.swift index 7c32559c..f3217644 100644 --- a/Sources/CucumberSwift/StubGeneration/Method.swift +++ b/Sources/CucumberSwift/StubGeneration/Method.swift @@ -49,8 +49,10 @@ class Method { var methodString = "\(keywordString.capitalizingFirstLetter())(\"^\(regex.trimmingCharacters(in: .whitespacesAndNewlines))$\") { \(matchesParameter), \(stepParameter) in\n" for variable in variables { for i in 0.. 0) ? NumberFormatter.localizedString(from: .init(value: i + 1), - number: .spellOut) : "" + let formatter = NumberFormatter() + formatter.numberStyle = .spellOut + formatter.locale = Locale(identifier: "en-US") + let spelledNumber = (i > 0) ? formatter.string(from: .init(value: i + 1)) ?? "" : "" let varName = "\(variable.type) \(spelledNumber)".camelCasingString() if variable.type != "dataTable" && variable.type != "docString" { methodString += " let \(varName) = \(matchesParameter)[\(i + 1)]\n"