resgen.swift/Tests/ResgenSwiftTests/Strings/StringFileGeneratorTests/Expectation/StringsFileGenerator+R2ExtensionsExpectation.swift
Thibaut Schmitt c3445042b7
Some checks reported warnings
gitea-openium/resgen.swift/pipeline/head This commit is unstable
Remove a lots of code duplication in StringsFileGeneratorTests
2025-04-30 15:24:39 +02:00

92 lines
3.4 KiB
Swift

//
// StringsFileGenerator+R2ExtensionsExpectation.swift
// ResgenSwift
//
// Created by Thibaut Schmitt on 30/04/2025.
//
@testable import ResgenSwift
import ToolCore
extension StringsFileGeneratorTests {
static func getExtensionContentExpectation(
staticVar: Bool,
s1DefOneFr: String = "Section Un - Definition Un",
s1DefOneComment: String = "",
s1DefTwoFr: String = "Section Un - Definition Deux",
s1DefTwoComment: String = "",
s2DefOneFr: String = "Section Deux - Definition Un",
s2DefOneComment: String = "",
s2DefTwoFr: String = "Section Deux - Definition Deux",
s2DefTwoComment: String = "",
) -> String {
"""
// Generated by ResgenSwift.Strings.Stringium \(ResgenSwiftVersion)
import UIKit
fileprivate let kStringsFileName = "myInputFilename"
extension GenStrings {
enum KeyStrings: String {
case s1_def_one = "s1_def_one"
case s1_def_two = "s1_def_two"
case s2_def_one = "s2_def_one"
case s2_def_two = "s2_def_two"
var keyPath: KeyPath<GenStrings, String> {
switch self {
case .s1_def_one: return \\GenStrings.s1_def_one
case .s1_def_two: return \\GenStrings.s1_def_two
case .s2_def_one: return \\GenStrings.s2_def_one
case .s2_def_two: return \\GenStrings.s2_def_two
}
}
}
// MARK: - section_one
/// Translation in fr :
/// \(s1DefOneFr)
///
/// Comment :
/// \(s1DefOneComment.isEmpty ? "No comment" : s1DefOneComment)
\(staticVar ? "static " : "")var s1_def_one: String {
NSLocalizedString("s1_def_one", tableName: kStringsFileName, bundle: Bundle.main, value: "Section Un - Definition Un", comment: "\(s1DefOneComment)")
}
/// Translation in fr :
/// \(s1DefTwoFr)
///
/// Comment :
/// \(s1DefTwoComment.isEmpty ? "No comment" : s1DefTwoComment)
\(staticVar ? "static " : "")var s1_def_two: String {
NSLocalizedString("s1_def_two", tableName: kStringsFileName, bundle: Bundle.main, value: "Section Un - Definition Deux", comment: "\(s1DefTwoComment)")
}
// MARK: - section_two
/// Translation in fr :
/// \(s2DefOneFr)
///
/// Comment :
/// \(s2DefOneComment.isEmpty ? "No comment" : s2DefOneComment)
\(staticVar ? "static " : "")var s2_def_one: String {
NSLocalizedString("s2_def_one", tableName: kStringsFileName, bundle: Bundle.main, value: "Section Deux - Definition Un", comment: "\(s2DefOneComment)")
}
/// Translation in fr :
/// \(s2DefTwoFr)
///
/// Comment :
/// \(s2DefTwoComment.isEmpty ? "No comment" : s2DefTwoComment)
\(staticVar ? "static " : "")var s2_def_two: String {
NSLocalizedString("s2_def_two", tableName: kStringsFileName, bundle: Bundle.main, value: "Section Deux - Definition Deux", comment: "\(s2DefTwoComment)")
}
}
"""
}
}