Add visibility parameters to control scope of generated extension
Some checks failed
gitea-openium/resgen.swift/pipeline/head There was a failure building this commit
Some checks failed
gitea-openium/resgen.swift/pipeline/head There was a failure building this commit
This commit is contained in:
@ -55,11 +55,11 @@ final class AnalyticsDefinitionTests: XCTestCase {
|
||||
definition.path = "ecran_un/"
|
||||
|
||||
// When
|
||||
let propertyScreen = definition.getProperty()
|
||||
|
||||
let propertyScreen = definition.getProperty(visibility: .internal)
|
||||
|
||||
// Expect
|
||||
let expectScreen = """
|
||||
func logScreenDefinitionName() {
|
||||
internal func logScreenDefinitionName() {
|
||||
logScreen(
|
||||
name: "Ecran un",
|
||||
path: "ecran_un/",
|
||||
@ -76,11 +76,11 @@ final class AnalyticsDefinitionTests: XCTestCase {
|
||||
let definition = AnalyticsDefinition(id: "definition_name", name: "Ecran un", type: .event)
|
||||
|
||||
// When
|
||||
let propertyEvent = definition.getProperty()
|
||||
|
||||
let propertyEvent = definition.getProperty(visibility: .public)
|
||||
|
||||
// Expect
|
||||
let expectEvent = """
|
||||
func logEventDefinitionName() {
|
||||
public func logEventDefinitionName() {
|
||||
logEvent(
|
||||
name: "Ecran un",
|
||||
action: "",
|
||||
@ -99,11 +99,11 @@ final class AnalyticsDefinitionTests: XCTestCase {
|
||||
definition.path = "ecran_un/"
|
||||
|
||||
// When
|
||||
let propertyScreen = definition.getStaticProperty()
|
||||
|
||||
let propertyScreen = definition.getStaticProperty(visibility: .private)
|
||||
|
||||
// Expect
|
||||
let expectScreen = """
|
||||
static func logScreenDefinitionName() {
|
||||
private static func logScreenDefinitionName() {
|
||||
AnalyticsManager.shared.logScreen(
|
||||
name: "Ecran un",
|
||||
path: "ecran_un/",
|
||||
@ -120,11 +120,11 @@ final class AnalyticsDefinitionTests: XCTestCase {
|
||||
let definition = AnalyticsDefinition(id: "definition_name", name: "Ecran un", type: .event)
|
||||
|
||||
// When
|
||||
let propertyEvent = definition.getStaticProperty()
|
||||
|
||||
let propertyEvent = definition.getStaticProperty(visibility: .package)
|
||||
|
||||
// Expect
|
||||
let expectEvent = """
|
||||
static func logEventDefinitionName() {
|
||||
package static func logEventDefinitionName() {
|
||||
AnalyticsManager.shared.logEvent(
|
||||
name: "Ecran un",
|
||||
action: "",
|
||||
|
@ -32,11 +32,11 @@ final class AnalyticsGeneratorTests: XCTestCase {
|
||||
return definition
|
||||
}
|
||||
|
||||
private func protocolString() -> String {
|
||||
private func protocolString(visibility: ExtensionVisibility) -> String {
|
||||
"""
|
||||
// MARK: - Protocol
|
||||
|
||||
protocol AnalyticsManagerProtocol {
|
||||
\(visibility) protocol AnalyticsManagerProtocol {
|
||||
|
||||
func logScreen(
|
||||
name: String,
|
||||
@ -234,7 +234,7 @@ final class AnalyticsGeneratorTests: XCTestCase {
|
||||
sections: [sectionOne, sectionTwo, sectionThree],
|
||||
tags: ["ios", "iosonly"],
|
||||
staticVar: false,
|
||||
extensionName: "GenAnalytics"
|
||||
visibility: .public
|
||||
)
|
||||
|
||||
// Expect Analytics
|
||||
@ -244,22 +244,22 @@ final class AnalyticsGeneratorTests: XCTestCase {
|
||||
import Foundation
|
||||
import FirebaseAnalytics
|
||||
|
||||
\(protocolString())
|
||||
\(protocolString(visibility: .public))
|
||||
|
||||
\(firebaseString())
|
||||
|
||||
// MARK: - Traker Type
|
||||
|
||||
enum TrackerType: CaseIterable {
|
||||
public enum TrackerType: CaseIterable {
|
||||
|
||||
case firebase
|
||||
}
|
||||
|
||||
// MARK: - Manager
|
||||
|
||||
class AnalyticsManager {
|
||||
public class AnalyticsManager {
|
||||
|
||||
static var shared = AnalyticsManager()
|
||||
public static var shared = AnalyticsManager()
|
||||
|
||||
private init() {}
|
||||
|
||||
@ -287,15 +287,15 @@ final class AnalyticsGeneratorTests: XCTestCase {
|
||||
}
|
||||
}
|
||||
|
||||
func enableAnalytics(_ analytics: [TrackerType] = TrackerType.allCases) {
|
||||
public func enableAnalytics(_ analytics: [TrackerType] = TrackerType.allCases) {
|
||||
setAnalytics(enable: true, analytics)
|
||||
}
|
||||
|
||||
func disableAnalytics(_ analytics: [TrackerType] = TrackerType.allCases) {
|
||||
public func disableAnalytics(_ analytics: [TrackerType] = TrackerType.allCases) {
|
||||
setAnalytics(enable: false, analytics)
|
||||
}
|
||||
|
||||
func configure() {
|
||||
public func configure() {
|
||||
managers[TrackerType.firebase] = FirebaseAnalyticsManager()
|
||||
}
|
||||
|
||||
@ -337,7 +337,7 @@ final class AnalyticsGeneratorTests: XCTestCase {
|
||||
|
||||
// MARK: - section_one
|
||||
|
||||
func logScreenS1DefOne() {
|
||||
public func logScreenS1DefOne() {
|
||||
logScreen(
|
||||
name: "s1 def one",
|
||||
path: "",
|
||||
@ -345,7 +345,7 @@ final class AnalyticsGeneratorTests: XCTestCase {
|
||||
)
|
||||
}
|
||||
|
||||
func logEventS1DefTwo() {
|
||||
public func logEventS1DefTwo() {
|
||||
logEvent(
|
||||
name: "s1 def two",
|
||||
action: "",
|
||||
@ -356,7 +356,7 @@ final class AnalyticsGeneratorTests: XCTestCase {
|
||||
|
||||
// MARK: - section_two
|
||||
|
||||
func logScreenS2DefOne() {
|
||||
public func logScreenS2DefOne() {
|
||||
logScreen(
|
||||
name: "s2 def one",
|
||||
path: "",
|
||||
@ -399,7 +399,7 @@ final class AnalyticsGeneratorTests: XCTestCase {
|
||||
sections: [sectionOne, sectionTwo, sectionThree],
|
||||
tags: ["ios", "iosonly"],
|
||||
staticVar: false,
|
||||
extensionName: "GenAnalytics"
|
||||
visibility: .package
|
||||
)
|
||||
// Expect Analytics
|
||||
let expect = """
|
||||
@ -408,22 +408,22 @@ final class AnalyticsGeneratorTests: XCTestCase {
|
||||
import Foundation
|
||||
import MatomoTracker
|
||||
|
||||
\(protocolString())
|
||||
\(protocolString(visibility: .package))
|
||||
|
||||
\(matomoString())
|
||||
|
||||
// MARK: - Traker Type
|
||||
|
||||
enum TrackerType: CaseIterable {
|
||||
package enum TrackerType: CaseIterable {
|
||||
|
||||
case matomo
|
||||
}
|
||||
|
||||
// MARK: - Manager
|
||||
|
||||
class AnalyticsManager {
|
||||
package class AnalyticsManager {
|
||||
|
||||
static var shared = AnalyticsManager()
|
||||
package static var shared = AnalyticsManager()
|
||||
|
||||
private init() {}
|
||||
|
||||
@ -451,15 +451,15 @@ final class AnalyticsGeneratorTests: XCTestCase {
|
||||
}
|
||||
}
|
||||
|
||||
func enableAnalytics(_ analytics: [TrackerType] = TrackerType.allCases) {
|
||||
package func enableAnalytics(_ analytics: [TrackerType] = TrackerType.allCases) {
|
||||
setAnalytics(enable: true, analytics)
|
||||
}
|
||||
|
||||
func disableAnalytics(_ analytics: [TrackerType] = TrackerType.allCases) {
|
||||
package func disableAnalytics(_ analytics: [TrackerType] = TrackerType.allCases) {
|
||||
setAnalytics(enable: false, analytics)
|
||||
}
|
||||
|
||||
func configure(siteId: String, url: String) {
|
||||
package func configure(siteId: String, url: String) {
|
||||
managers[TrackerType.matomo] = MatomoAnalyticsManager(
|
||||
siteId: siteId,
|
||||
url: url
|
||||
@ -504,7 +504,7 @@ final class AnalyticsGeneratorTests: XCTestCase {
|
||||
|
||||
// MARK: - section_one
|
||||
|
||||
func logScreenS1DefOne() {
|
||||
package func logScreenS1DefOne() {
|
||||
logScreen(
|
||||
name: "s1 def one",
|
||||
path: "s1_def_one/",
|
||||
@ -512,7 +512,7 @@ final class AnalyticsGeneratorTests: XCTestCase {
|
||||
)
|
||||
}
|
||||
|
||||
func logEventS1DefTwo() {
|
||||
package func logEventS1DefTwo() {
|
||||
logEvent(
|
||||
name: "s1 def two",
|
||||
action: "test",
|
||||
@ -523,7 +523,7 @@ final class AnalyticsGeneratorTests: XCTestCase {
|
||||
|
||||
// MARK: - section_two
|
||||
|
||||
func logScreenS2DefOne() {
|
||||
package func logScreenS2DefOne() {
|
||||
logScreen(
|
||||
name: "s2 def one",
|
||||
path: "s2_def_one/",
|
||||
@ -566,7 +566,7 @@ final class AnalyticsGeneratorTests: XCTestCase {
|
||||
sections: [sectionOne, sectionTwo, sectionThree],
|
||||
tags: ["ios", "iosonly"],
|
||||
staticVar: false,
|
||||
extensionName: "GenAnalytics"
|
||||
visibility: .internal
|
||||
)
|
||||
|
||||
// Expect Analytics
|
||||
@ -577,7 +577,7 @@ final class AnalyticsGeneratorTests: XCTestCase {
|
||||
import MatomoTracker
|
||||
import FirebaseAnalytics
|
||||
|
||||
\(protocolString())
|
||||
\(protocolString(visibility: .internal))
|
||||
|
||||
\(matomoString())
|
||||
|
||||
@ -585,7 +585,7 @@ final class AnalyticsGeneratorTests: XCTestCase {
|
||||
|
||||
// MARK: - Traker Type
|
||||
|
||||
enum TrackerType: CaseIterable {
|
||||
internal enum TrackerType: CaseIterable {
|
||||
|
||||
case matomo
|
||||
case firebase
|
||||
@ -593,9 +593,9 @@ final class AnalyticsGeneratorTests: XCTestCase {
|
||||
|
||||
// MARK: - Manager
|
||||
|
||||
class AnalyticsManager {
|
||||
internal class AnalyticsManager {
|
||||
|
||||
static var shared = AnalyticsManager()
|
||||
internal static var shared = AnalyticsManager()
|
||||
|
||||
private init() {}
|
||||
|
||||
@ -623,15 +623,15 @@ final class AnalyticsGeneratorTests: XCTestCase {
|
||||
}
|
||||
}
|
||||
|
||||
func enableAnalytics(_ analytics: [TrackerType] = TrackerType.allCases) {
|
||||
internal func enableAnalytics(_ analytics: [TrackerType] = TrackerType.allCases) {
|
||||
setAnalytics(enable: true, analytics)
|
||||
}
|
||||
|
||||
func disableAnalytics(_ analytics: [TrackerType] = TrackerType.allCases) {
|
||||
internal func disableAnalytics(_ analytics: [TrackerType] = TrackerType.allCases) {
|
||||
setAnalytics(enable: false, analytics)
|
||||
}
|
||||
|
||||
func configure(siteId: String, url: String) {
|
||||
internal func configure(siteId: String, url: String) {
|
||||
managers[TrackerType.matomo] = MatomoAnalyticsManager(
|
||||
siteId: siteId,
|
||||
url: url
|
||||
@ -677,7 +677,7 @@ final class AnalyticsGeneratorTests: XCTestCase {
|
||||
|
||||
// MARK: - section_one
|
||||
|
||||
func logScreenS1DefOne() {
|
||||
internal func logScreenS1DefOne() {
|
||||
logScreen(
|
||||
name: "s1 def one",
|
||||
path: "s1_def_one/",
|
||||
@ -685,7 +685,7 @@ final class AnalyticsGeneratorTests: XCTestCase {
|
||||
)
|
||||
}
|
||||
|
||||
func logEventS1DefTwo() {
|
||||
internal func logEventS1DefTwo() {
|
||||
logEvent(
|
||||
name: "s1 def two",
|
||||
action: "test",
|
||||
@ -696,7 +696,7 @@ final class AnalyticsGeneratorTests: XCTestCase {
|
||||
|
||||
// MARK: - section_two
|
||||
|
||||
func logScreenS2DefOne() {
|
||||
internal func logScreenS2DefOne() {
|
||||
logScreen(
|
||||
name: "s2 def one",
|
||||
path: "s2_def_one/",
|
||||
|
@ -21,10 +21,13 @@ final class ColorExtensionGeneratorTests: XCTestCase {
|
||||
]
|
||||
|
||||
// When
|
||||
let extensionContent = ColorExtensionGenerator.getExtensionContent(colors: colors,
|
||||
staticVar: false,
|
||||
extensionName: "GenColors",
|
||||
isSwiftUI: false)
|
||||
let extensionContent = ColorExtensionGenerator.getExtensionContent(
|
||||
colors: colors,
|
||||
staticVar: false,
|
||||
extensionName: "GenColors",
|
||||
isSwiftUI: false,
|
||||
visibility: .public
|
||||
)
|
||||
|
||||
// Expect
|
||||
let expect = """
|
||||
@ -35,12 +38,12 @@ final class ColorExtensionGeneratorTests: XCTestCase {
|
||||
extension GenColors {
|
||||
|
||||
/// Color colorOne is #FF00FF (light) or #00FF00 (dark)"
|
||||
@objc var colorOne: UIColor {
|
||||
@objc public var colorOne: UIColor {
|
||||
UIColor(named: "colorOne")!
|
||||
}
|
||||
|
||||
/// Color colorTwo is #F0F0F0 (light) or #0F0F0F (dark)"
|
||||
@objc var colorTwo: UIColor {
|
||||
@objc public var colorTwo: UIColor {
|
||||
UIColor(named: "colorTwo")!
|
||||
}
|
||||
}
|
||||
@ -57,10 +60,13 @@ final class ColorExtensionGeneratorTests: XCTestCase {
|
||||
]
|
||||
|
||||
// When
|
||||
let extensionContent = ColorExtensionGenerator.getExtensionContent(colors: colors,
|
||||
staticVar: true,
|
||||
extensionName: "GenColor",
|
||||
isSwiftUI: false)
|
||||
let extensionContent = ColorExtensionGenerator.getExtensionContent(
|
||||
colors: colors,
|
||||
staticVar: true,
|
||||
extensionName: "GenColor",
|
||||
isSwiftUI: false,
|
||||
visibility: .public
|
||||
)
|
||||
|
||||
// Expect
|
||||
let expect = """
|
||||
@ -71,12 +77,12 @@ final class ColorExtensionGeneratorTests: XCTestCase {
|
||||
extension GenColor {
|
||||
|
||||
/// Color colorOne is #FF00FF (light) or #00FF00 (dark)"
|
||||
static var colorOne: UIColor {
|
||||
public static var colorOne: UIColor {
|
||||
UIColor(named: "colorOne")!
|
||||
}
|
||||
|
||||
/// Color colorTwo is #F0F0F0 (light) or #0F0F0F (dark)"
|
||||
static var colorTwo: UIColor {
|
||||
public static var colorTwo: UIColor {
|
||||
UIColor(named: "colorTwo")!
|
||||
}
|
||||
}
|
||||
@ -93,10 +99,13 @@ final class ColorExtensionGeneratorTests: XCTestCase {
|
||||
]
|
||||
|
||||
// When
|
||||
let extensionContent = ColorExtensionGenerator.getExtensionContent(colors: colors,
|
||||
staticVar: false,
|
||||
extensionName: "GenColors",
|
||||
isSwiftUI: true)
|
||||
let extensionContent = ColorExtensionGenerator.getExtensionContent(
|
||||
colors: colors,
|
||||
staticVar: false,
|
||||
extensionName: "GenColors",
|
||||
isSwiftUI: true,
|
||||
visibility: .package
|
||||
)
|
||||
|
||||
// Expect
|
||||
let expect = """
|
||||
@ -107,12 +116,12 @@ final class ColorExtensionGeneratorTests: XCTestCase {
|
||||
extension GenColors {
|
||||
|
||||
/// Color colorOne is #FF00FF (light) or #00FF00 (dark)"
|
||||
var colorOne: Color {
|
||||
package var colorOne: Color {
|
||||
Color("colorOne")
|
||||
}
|
||||
|
||||
/// Color colorTwo is #F0F0F0 (light) or #0F0F0F (dark)"
|
||||
var colorTwo: Color {
|
||||
package var colorTwo: Color {
|
||||
Color("colorTwo")
|
||||
}
|
||||
}
|
||||
@ -129,10 +138,13 @@ final class ColorExtensionGeneratorTests: XCTestCase {
|
||||
]
|
||||
|
||||
// When
|
||||
let extensionContent = ColorExtensionGenerator.getExtensionContent(colors: colors,
|
||||
staticVar: true,
|
||||
extensionName: "GenColor",
|
||||
isSwiftUI: true)
|
||||
let extensionContent = ColorExtensionGenerator.getExtensionContent(
|
||||
colors: colors,
|
||||
staticVar: true,
|
||||
extensionName: "GenColor",
|
||||
isSwiftUI: true,
|
||||
visibility: .internal
|
||||
)
|
||||
|
||||
// Expect
|
||||
let expect = """
|
||||
@ -143,12 +155,12 @@ final class ColorExtensionGeneratorTests: XCTestCase {
|
||||
extension GenColor {
|
||||
|
||||
/// Color colorOne is #FF00FF (light) or #00FF00 (dark)"
|
||||
static var colorOne: Color {
|
||||
internal static var colorOne: Color {
|
||||
Color("colorOne")
|
||||
}
|
||||
|
||||
/// Color colorTwo is #F0F0F0 (light) or #0F0F0F (dark)"
|
||||
static var colorTwo: Color {
|
||||
internal static var colorTwo: Color {
|
||||
Color("colorTwo")
|
||||
}
|
||||
}
|
||||
|
@ -17,12 +17,16 @@ final class ParsedColorTests: XCTestCase {
|
||||
let color = ParsedColor(name: "red", light: "#FF0000", dark: "#0000FF")
|
||||
|
||||
// When
|
||||
let property = color.getColorProperty(isStatic: false, isSwiftUI: false)
|
||||
let property = color.getColorProperty(
|
||||
isStatic: false,
|
||||
isSwiftUI: false,
|
||||
visibility: .public
|
||||
)
|
||||
|
||||
// Expect
|
||||
let expect = """
|
||||
/// Color red is #FF0000 (light) or #0000FF (dark)"
|
||||
@objc var red: UIColor {
|
||||
@objc public var red: UIColor {
|
||||
UIColor(named: "red")!
|
||||
}
|
||||
"""
|
||||
@ -35,12 +39,16 @@ final class ParsedColorTests: XCTestCase {
|
||||
let color = ParsedColor(name: "red", light: "#FF0000", dark: "#0000FF")
|
||||
|
||||
// When
|
||||
let property = color.getColorProperty(isStatic: true, isSwiftUI: false)
|
||||
let property = color.getColorProperty(
|
||||
isStatic: true,
|
||||
isSwiftUI: false,
|
||||
visibility: .private
|
||||
)
|
||||
|
||||
// Expect
|
||||
let expect = """
|
||||
/// Color red is #FF0000 (light) or #0000FF (dark)"
|
||||
static var red: UIColor {
|
||||
private static var red: UIColor {
|
||||
UIColor(named: "red")!
|
||||
}
|
||||
"""
|
||||
@ -53,12 +61,16 @@ final class ParsedColorTests: XCTestCase {
|
||||
let color = ParsedColor(name: "red", light: "#FF0000", dark: "#0000FF")
|
||||
|
||||
// When
|
||||
let property = color.getColorProperty(isStatic: false, isSwiftUI: true)
|
||||
let property = color.getColorProperty(
|
||||
isStatic: false,
|
||||
isSwiftUI: true,
|
||||
visibility: .package
|
||||
)
|
||||
|
||||
// Expect
|
||||
let expect = """
|
||||
/// Color red is #FF0000 (light) or #0000FF (dark)"
|
||||
var red: Color {
|
||||
package var red: Color {
|
||||
Color("red")
|
||||
}
|
||||
"""
|
||||
@ -71,12 +83,16 @@ final class ParsedColorTests: XCTestCase {
|
||||
let color = ParsedColor(name: "red", light: "#FF0000", dark: "#0000FF")
|
||||
|
||||
// When
|
||||
let property = color.getColorProperty(isStatic: true, isSwiftUI: true)
|
||||
let property = color.getColorProperty(
|
||||
isStatic: true,
|
||||
isSwiftUI: true,
|
||||
visibility: .internal
|
||||
)
|
||||
|
||||
// Expect
|
||||
let expect = """
|
||||
/// Color red is #FF0000 (light) or #0000FF (dark)"
|
||||
static var red: Color {
|
||||
internal static var red: Color {
|
||||
Color("red")
|
||||
}
|
||||
"""
|
||||
|
@ -21,10 +21,13 @@ final class FontExtensionGeneratorTests: XCTestCase {
|
||||
]
|
||||
|
||||
// When
|
||||
let extensionContent = FontExtensionGenerator.getExtensionContent(fontsNames: fontNames,
|
||||
staticVar: false,
|
||||
extensionName: "GenFonts",
|
||||
isSwiftUI: false)
|
||||
let extensionContent = FontExtensionGenerator.getExtensionContent(
|
||||
fontsNames: fontNames,
|
||||
staticVar: false,
|
||||
extensionName: "GenFonts",
|
||||
isSwiftUI: false,
|
||||
visibility: .public
|
||||
)
|
||||
|
||||
// Expect
|
||||
let expect = """
|
||||
@ -34,18 +37,18 @@ final class FontExtensionGeneratorTests: XCTestCase {
|
||||
|
||||
extension GenFonts {
|
||||
|
||||
enum FontName: String {
|
||||
public enum FontName: String {
|
||||
case CircularStdRegular = "CircularStd-Regular"
|
||||
case CircularStdBold = "CircularStd-Bold"
|
||||
}
|
||||
|
||||
// MARK: - Getter
|
||||
|
||||
func CircularStdRegular(withSize size: CGFloat) -> UIFont {
|
||||
public func CircularStdRegular(withSize size: CGFloat) -> UIFont {
|
||||
UIFont(name: FontName.CircularStdRegular.rawValue, size: size)!
|
||||
}
|
||||
|
||||
func CircularStdBold(withSize size: CGFloat) -> UIFont {
|
||||
public func CircularStdBold(withSize size: CGFloat) -> UIFont {
|
||||
UIFont(name: FontName.CircularStdBold.rawValue, size: size)!
|
||||
}
|
||||
|
||||
@ -64,10 +67,13 @@ final class FontExtensionGeneratorTests: XCTestCase {
|
||||
]
|
||||
|
||||
// When
|
||||
let extensionContent = FontExtensionGenerator.getExtensionContent(fontsNames: fontNames,
|
||||
staticVar: false,
|
||||
extensionName: "GenFonts",
|
||||
isSwiftUI: true)
|
||||
let extensionContent = FontExtensionGenerator.getExtensionContent(
|
||||
fontsNames: fontNames,
|
||||
staticVar: false,
|
||||
extensionName: "GenFonts",
|
||||
isSwiftUI: true,
|
||||
visibility: .package
|
||||
)
|
||||
|
||||
// Expect
|
||||
let expect = """
|
||||
@ -77,18 +83,18 @@ final class FontExtensionGeneratorTests: XCTestCase {
|
||||
|
||||
extension GenFonts {
|
||||
|
||||
enum FontName: String {
|
||||
package enum FontName: String {
|
||||
case CircularStdRegular = "CircularStd-Regular"
|
||||
case CircularStdBold = "CircularStd-Bold"
|
||||
}
|
||||
|
||||
// MARK: - Getter
|
||||
|
||||
func CircularStdRegular(withSize size: CGFloat) -> Font {
|
||||
package func CircularStdRegular(withSize size: CGFloat) -> Font {
|
||||
Font.custom(FontName.CircularStdRegular.rawValue, size: size)
|
||||
}
|
||||
|
||||
func CircularStdBold(withSize size: CGFloat) -> Font {
|
||||
package func CircularStdBold(withSize size: CGFloat) -> Font {
|
||||
Font.custom(FontName.CircularStdBold.rawValue, size: size)
|
||||
}
|
||||
|
||||
|
@ -21,11 +21,15 @@ final class FontNameTests: XCTestCase {
|
||||
)
|
||||
|
||||
// When
|
||||
let property = fontName.getProperty(isStatic: true, isSwiftUI: false)
|
||||
let property = fontName.getProperty(
|
||||
isStatic: true,
|
||||
isSwiftUI: false,
|
||||
visibility: .internal
|
||||
)
|
||||
|
||||
// Expect
|
||||
let expect = """
|
||||
static let CircularStdBold: ((_ size: CGFloat) -> UIFont) = { size in
|
||||
internal static let CircularStdBold: ((_ size: CGFloat) -> UIFont) = { size in
|
||||
UIFont(name: FontName.CircularStdBold.rawValue, size: size)!
|
||||
}
|
||||
"""
|
||||
@ -42,11 +46,15 @@ final class FontNameTests: XCTestCase {
|
||||
)
|
||||
|
||||
// When
|
||||
let property = fontName.getProperty(isStatic: true, isSwiftUI: false)
|
||||
let property = fontName.getProperty(
|
||||
isStatic: true,
|
||||
isSwiftUI: false,
|
||||
visibility: .package
|
||||
)
|
||||
|
||||
// Expect
|
||||
let expect = """
|
||||
static let CircularStdBoldUnderline: ((_ size: CGFloat) -> UIFont) = { size in
|
||||
package static let CircularStdBoldUnderline: ((_ size: CGFloat) -> UIFont) = { size in
|
||||
UIFont(name: FontName.CircularStdBoldUnderline.rawValue, size: size)!
|
||||
}
|
||||
"""
|
||||
@ -63,11 +71,15 @@ final class FontNameTests: XCTestCase {
|
||||
)
|
||||
|
||||
// When
|
||||
let property = fontName.getProperty(isStatic: false, isSwiftUI: false)
|
||||
let property = fontName.getProperty(
|
||||
isStatic: false,
|
||||
isSwiftUI: false,
|
||||
visibility: .private
|
||||
)
|
||||
|
||||
// Expect
|
||||
let expect = """
|
||||
func CircularStdBold(withSize size: CGFloat) -> UIFont {
|
||||
private func CircularStdBold(withSize size: CGFloat) -> UIFont {
|
||||
UIFont(name: FontName.CircularStdBold.rawValue, size: size)!
|
||||
}
|
||||
"""
|
||||
@ -84,11 +96,15 @@ final class FontNameTests: XCTestCase {
|
||||
)
|
||||
|
||||
// When
|
||||
let property = fontName.getProperty(isStatic: false, isSwiftUI: false)
|
||||
let property = fontName.getProperty(
|
||||
isStatic: false,
|
||||
isSwiftUI: false,
|
||||
visibility: .public
|
||||
)
|
||||
|
||||
// Expect
|
||||
let expect = """
|
||||
func CircularStdBoldUnderline(withSize size: CGFloat) -> UIFont {
|
||||
public func CircularStdBoldUnderline(withSize size: CGFloat) -> UIFont {
|
||||
UIFont(name: FontName.CircularStdBoldUnderline.rawValue, size: size)!
|
||||
}
|
||||
"""
|
||||
@ -105,11 +121,15 @@ final class FontNameTests: XCTestCase {
|
||||
)
|
||||
|
||||
// When
|
||||
let property = fontName.getProperty(isStatic: true, isSwiftUI: true)
|
||||
let property = fontName.getProperty(
|
||||
isStatic: true,
|
||||
isSwiftUI: true,
|
||||
visibility: .public
|
||||
)
|
||||
|
||||
// Expect
|
||||
let expect = """
|
||||
static let CircularStdBold: ((_ size: CGFloat) -> Font) = { size in
|
||||
public static let CircularStdBold: ((_ size: CGFloat) -> Font) = { size in
|
||||
Font.custom(FontName.CircularStdBold.rawValue, size: size)
|
||||
}
|
||||
"""
|
||||
@ -126,11 +146,15 @@ final class FontNameTests: XCTestCase {
|
||||
)
|
||||
|
||||
// When
|
||||
let property = fontName.getProperty(isStatic: true, isSwiftUI: true)
|
||||
let property = fontName.getProperty(
|
||||
isStatic: true,
|
||||
isSwiftUI: true,
|
||||
visibility: .package
|
||||
)
|
||||
|
||||
// Expect
|
||||
let expect = """
|
||||
static let CircularStdBoldUnderline: ((_ size: CGFloat) -> Font) = { size in
|
||||
package static let CircularStdBoldUnderline: ((_ size: CGFloat) -> Font) = { size in
|
||||
Font.custom(FontName.CircularStdBoldUnderline.rawValue, size: size)
|
||||
}
|
||||
"""
|
||||
@ -147,11 +171,15 @@ final class FontNameTests: XCTestCase {
|
||||
)
|
||||
|
||||
// When
|
||||
let property = fontName.getProperty(isStatic: false, isSwiftUI: true)
|
||||
let property = fontName.getProperty(
|
||||
isStatic: false,
|
||||
isSwiftUI: true,
|
||||
visibility: .package
|
||||
)
|
||||
|
||||
// Expect
|
||||
let expect = """
|
||||
func CircularStdBold(withSize size: CGFloat) -> Font {
|
||||
package func CircularStdBold(withSize size: CGFloat) -> Font {
|
||||
Font.custom(FontName.CircularStdBold.rawValue, size: size)
|
||||
}
|
||||
"""
|
||||
@ -168,11 +196,15 @@ final class FontNameTests: XCTestCase {
|
||||
)
|
||||
|
||||
// When
|
||||
let property = fontName.getProperty(isStatic: false, isSwiftUI: true)
|
||||
let property = fontName.getProperty(
|
||||
isStatic: false,
|
||||
isSwiftUI: true,
|
||||
visibility: .internal
|
||||
)
|
||||
|
||||
// Expect
|
||||
let expect = """
|
||||
func CircularStdBoldUnderline(withSize size: CGFloat) -> Font {
|
||||
internal func CircularStdBoldUnderline(withSize size: CGFloat) -> Font {
|
||||
Font.custom(FontName.CircularStdBoldUnderline.rawValue, size: size)
|
||||
}
|
||||
"""
|
||||
|
@ -0,0 +1,76 @@
|
||||
//
|
||||
// AnalyticsConfigurationTests.swift
|
||||
// ResgenSwift
|
||||
//
|
||||
// Created by Thibaut Schmitt on 18/07/2025.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
@testable import ResgenSwift
|
||||
import XCTest
|
||||
|
||||
final class AnalyticsConfigurationTests: XCTestCase {
|
||||
|
||||
let projectDirectory = "projectDirectory/"
|
||||
|
||||
func test_argsGeneration_requiredArgs() {
|
||||
// Given
|
||||
let testingConfiguration = AnalyticsConfiguration(
|
||||
inputFile: "path/to/tags.yml",
|
||||
target: "matomo firebase",
|
||||
outputFile: "Analytics/Generated/AnalyticsManager.swift",
|
||||
visibility: nil,
|
||||
staticMembers: nil
|
||||
)
|
||||
|
||||
// When
|
||||
let arguments = testingConfiguration.getArguments(
|
||||
projectDirectory: projectDirectory,
|
||||
force: false
|
||||
)
|
||||
|
||||
// Expect
|
||||
let expectedArguments = [
|
||||
"projectDirectory/path/to/tags.yml",
|
||||
"--target",
|
||||
"matomo firebase",
|
||||
"--output-file",
|
||||
"projectDirectory/Analytics/Generated/AnalyticsManager.swift",
|
||||
]
|
||||
|
||||
XCTAssertEqual(arguments, expectedArguments)
|
||||
}
|
||||
|
||||
func test_argsGeneration_allArguments() {
|
||||
// Given
|
||||
let testingConfiguration = AnalyticsConfiguration(
|
||||
inputFile: "path/to/tags.yml",
|
||||
target: "matomo firebase",
|
||||
outputFile: "Analytics/Generated/AnalyticsManager.swift",
|
||||
visibility: "public",
|
||||
staticMembers: false
|
||||
)
|
||||
|
||||
// When
|
||||
let arguments = testingConfiguration.getArguments(
|
||||
projectDirectory: projectDirectory,
|
||||
force: true
|
||||
)
|
||||
|
||||
// Expect
|
||||
let expectedArguments = [
|
||||
"-f",
|
||||
"projectDirectory/path/to/tags.yml",
|
||||
"--target",
|
||||
"matomo firebase",
|
||||
"--output-file",
|
||||
"projectDirectory/Analytics/Generated/AnalyticsManager.swift",
|
||||
"--visibility",
|
||||
"public",
|
||||
"--static-members",
|
||||
"false"
|
||||
]
|
||||
|
||||
XCTAssertEqual(arguments, expectedArguments)
|
||||
}
|
||||
}
|
@ -16,16 +16,22 @@ final class ColorsConfigurationTests: XCTestCase {
|
||||
|
||||
func test_argsGeneration_requiredArgs() {
|
||||
// Given
|
||||
let testingConfiguration = ColorsConfiguration(inputFile: "path/to/colors.txt",
|
||||
style: ColorStyle.all.rawValue,
|
||||
xcassetsPath: "path/to/assets.xcassets",
|
||||
extensionOutputPath: nil,
|
||||
extensionName: nil,
|
||||
extensionNameUIKit: nil,
|
||||
extensionSuffix: nil,
|
||||
staticMembers: false)
|
||||
let testingConfiguration = ColorsConfiguration(
|
||||
inputFile: "path/to/colors.txt",
|
||||
style: ColorStyle.all.rawValue,
|
||||
xcassetsPath: "path/to/assets.xcassets",
|
||||
extensionOutputPath: nil,
|
||||
extensionName: nil,
|
||||
extensionNameUIKit: nil,
|
||||
extensionSuffix: nil,
|
||||
visibility: nil,
|
||||
staticMembers: false
|
||||
)
|
||||
// When
|
||||
let arguments = testingConfiguration.getArguments(projectDirectory: projectDirectory, force: false)
|
||||
let arguments = testingConfiguration.getArguments(
|
||||
projectDirectory: projectDirectory,
|
||||
force: false
|
||||
)
|
||||
|
||||
// Expect
|
||||
let expectedArguments = [
|
||||
@ -43,16 +49,22 @@ final class ColorsConfigurationTests: XCTestCase {
|
||||
|
||||
func test_argsGeneration_allArguments() {
|
||||
// Given
|
||||
let testingConfiguration = ColorsConfiguration(inputFile: "path/to/colors.txt",
|
||||
style: ColorStyle.all.rawValue,
|
||||
xcassetsPath: "path/to/assets.xcassets",
|
||||
extensionOutputPath: "Colors/Generated",
|
||||
extensionName: "AppUIColor",
|
||||
extensionNameUIKit: "AppColor",
|
||||
extensionSuffix: "Testing",
|
||||
staticMembers: false)
|
||||
let testingConfiguration = ColorsConfiguration(
|
||||
inputFile: "path/to/colors.txt",
|
||||
style: ColorStyle.all.rawValue,
|
||||
xcassetsPath: "path/to/assets.xcassets",
|
||||
extensionOutputPath: "Colors/Generated",
|
||||
extensionName: "AppUIColor",
|
||||
extensionNameUIKit: "AppColor",
|
||||
extensionSuffix: "Testing",
|
||||
visibility: "public",
|
||||
staticMembers: false
|
||||
)
|
||||
// When
|
||||
let arguments = testingConfiguration.getArguments(projectDirectory: projectDirectory, force: true)
|
||||
let arguments = testingConfiguration.getArguments(
|
||||
projectDirectory: projectDirectory,
|
||||
force: true
|
||||
)
|
||||
|
||||
// Expect
|
||||
let expectedArguments = [
|
||||
@ -62,8 +74,6 @@ final class ColorsConfigurationTests: XCTestCase {
|
||||
"all",
|
||||
"--xcassets-path",
|
||||
"projectDirectory/path/to/assets.xcassets",
|
||||
"--static-members",
|
||||
"false",
|
||||
"--extension-output-path",
|
||||
"projectDirectory/Colors/Generated",
|
||||
"--extension-name",
|
||||
@ -72,6 +82,10 @@ final class ColorsConfigurationTests: XCTestCase {
|
||||
"AppColor",
|
||||
"--extension-suffix",
|
||||
"Testing",
|
||||
"--visibility",
|
||||
"public",
|
||||
"--static-members",
|
||||
"false"
|
||||
]
|
||||
|
||||
XCTAssertEqual(arguments, expectedArguments)
|
||||
|
@ -16,21 +16,25 @@ final class FontsConfigurationTests: XCTestCase {
|
||||
|
||||
func test_argsGeneration_requiredArgs() {
|
||||
// Given
|
||||
let testingConfiguration = FontsConfiguration(inputFile: "path/to/fonts.txt",
|
||||
extensionOutputPath: nil,
|
||||
extensionName: nil,
|
||||
extensionNameUIKit: nil,
|
||||
extensionSuffix: nil,
|
||||
infoPlistPaths: nil,
|
||||
staticMembers: nil)
|
||||
let testingConfiguration = FontsConfiguration(
|
||||
inputFile: "path/to/fonts.txt",
|
||||
extensionOutputPath: nil,
|
||||
extensionName: nil,
|
||||
extensionNameUIKit: nil,
|
||||
extensionSuffix: nil,
|
||||
infoPlistPaths: nil,
|
||||
visibility: nil,
|
||||
staticMembers: nil
|
||||
)
|
||||
// When
|
||||
let arguments = testingConfiguration.getArguments(projectDirectory: projectDirectory, force: false)
|
||||
let arguments = testingConfiguration.getArguments(
|
||||
projectDirectory: projectDirectory,
|
||||
force: false
|
||||
)
|
||||
|
||||
// Expect
|
||||
let expectedArguments = [
|
||||
"projectDirectory/path/to/fonts.txt",
|
||||
"--static-members",
|
||||
"false"
|
||||
"projectDirectory/path/to/fonts.txt"
|
||||
]
|
||||
|
||||
XCTAssertEqual(arguments, expectedArguments)
|
||||
@ -38,22 +42,26 @@ final class FontsConfigurationTests: XCTestCase {
|
||||
|
||||
func test_argsGeneration_allArguments() {
|
||||
// Given
|
||||
let testingConfiguration = FontsConfiguration(inputFile: "path/to/fonts.txt",
|
||||
extensionOutputPath: "Fonts/Generated",
|
||||
extensionName: "AppUIFont",
|
||||
extensionNameUIKit: "AppFont",
|
||||
extensionSuffix: "Testing",
|
||||
infoPlistPaths: "path/to/plist1.plist path/to/plist2.plist",
|
||||
staticMembers: true)
|
||||
let testingConfiguration = FontsConfiguration(
|
||||
inputFile: "path/to/fonts.txt",
|
||||
extensionOutputPath: "Fonts/Generated",
|
||||
extensionName: "AppUIFont",
|
||||
extensionNameUIKit: "AppFont",
|
||||
extensionSuffix: "Testing",
|
||||
infoPlistPaths: "path/to/plist1.plist path/to/plist2.plist",
|
||||
visibility: "package",
|
||||
staticMembers: true
|
||||
)
|
||||
// When
|
||||
let arguments = testingConfiguration.getArguments(projectDirectory: projectDirectory, force: true)
|
||||
let arguments = testingConfiguration.getArguments(
|
||||
projectDirectory: projectDirectory,
|
||||
force: true
|
||||
)
|
||||
|
||||
// Expect
|
||||
let expectedArguments = [
|
||||
"-f",
|
||||
"projectDirectory/path/to/fonts.txt",
|
||||
"--static-members",
|
||||
"true",
|
||||
"--extension-output-path",
|
||||
"projectDirectory/Fonts/Generated",
|
||||
"--extension-name",
|
||||
@ -62,6 +70,10 @@ final class FontsConfigurationTests: XCTestCase {
|
||||
"AppFont",
|
||||
"--extension-suffix",
|
||||
"Testing",
|
||||
"--visibility",
|
||||
"package",
|
||||
"--static-members",
|
||||
"true",
|
||||
"--info-plist-paths",
|
||||
"projectDirectory/path/to/plist1.plist projectDirectory/path/to/plist2.plist"
|
||||
]
|
||||
|
@ -16,24 +16,28 @@ final class ImagesConfigurationTests: XCTestCase {
|
||||
|
||||
func test_argsGeneration_requiredArgs() {
|
||||
// Given
|
||||
let testingConfiguration = ImagesConfiguration(inputFile: "path/to/images.txt",
|
||||
xcassetsPath: "path/to/assets.xcassets",
|
||||
extensionOutputPath: nil,
|
||||
extensionName: nil,
|
||||
extensionNameUIKit: nil,
|
||||
extensionSuffix: nil,
|
||||
staticMembers: nil)
|
||||
let testingConfiguration = ImagesConfiguration(
|
||||
inputFile: "path/to/images.txt",
|
||||
xcassetsPath: "path/to/assets.xcassets",
|
||||
extensionOutputPath: nil,
|
||||
extensionName: nil,
|
||||
extensionNameUIKit: nil,
|
||||
extensionSuffix: nil,
|
||||
visibility: nil,
|
||||
staticMembers: nil
|
||||
)
|
||||
|
||||
// When
|
||||
let arguments = testingConfiguration.getArguments(projectDirectory: projectDirectory, force: false)
|
||||
let arguments = testingConfiguration.getArguments(
|
||||
projectDirectory: projectDirectory,
|
||||
force: false
|
||||
)
|
||||
|
||||
// Expect
|
||||
let expectedArguments = [
|
||||
"projectDirectory/path/to/images.txt",
|
||||
"--xcassets-path",
|
||||
"projectDirectory/path/to/assets.xcassets",
|
||||
"--static-members",
|
||||
"false"
|
||||
"projectDirectory/path/to/assets.xcassets"
|
||||
]
|
||||
|
||||
XCTAssertEqual(arguments, expectedArguments)
|
||||
@ -41,16 +45,22 @@ final class ImagesConfigurationTests: XCTestCase {
|
||||
|
||||
func test_argsGeneration_allArguments() {
|
||||
// Given
|
||||
let testingConfiguration = ImagesConfiguration(inputFile: "path/to/images.txt",
|
||||
xcassetsPath: "path/to/assets.xcassets",
|
||||
extensionOutputPath: "Images/Generated",
|
||||
extensionName: "AppUIImage",
|
||||
extensionNameUIKit: "AppImage",
|
||||
extensionSuffix: "Testing",
|
||||
staticMembers: true)
|
||||
let testingConfiguration = ImagesConfiguration(
|
||||
inputFile: "path/to/images.txt",
|
||||
xcassetsPath: "path/to/assets.xcassets",
|
||||
extensionOutputPath: "Images/Generated",
|
||||
extensionName: "AppUIImage",
|
||||
extensionNameUIKit: "AppImage",
|
||||
extensionSuffix: "Testing",
|
||||
visibility: "private",
|
||||
staticMembers: true
|
||||
)
|
||||
|
||||
// When
|
||||
let arguments = testingConfiguration.getArguments(projectDirectory: projectDirectory, force: true)
|
||||
let arguments = testingConfiguration.getArguments(
|
||||
projectDirectory: projectDirectory,
|
||||
force: true
|
||||
)
|
||||
|
||||
// Expect
|
||||
let expectedArguments = [
|
||||
@ -58,8 +68,6 @@ final class ImagesConfigurationTests: XCTestCase {
|
||||
"projectDirectory/path/to/images.txt",
|
||||
"--xcassets-path",
|
||||
"projectDirectory/path/to/assets.xcassets",
|
||||
"--static-members",
|
||||
"true",
|
||||
"--extension-output-path",
|
||||
"projectDirectory/Images/Generated",
|
||||
"--extension-name",
|
||||
@ -68,6 +76,10 @@ final class ImagesConfigurationTests: XCTestCase {
|
||||
"AppImage",
|
||||
"--extension-suffix",
|
||||
"Testing",
|
||||
"--visibility",
|
||||
"private",
|
||||
"--static-members",
|
||||
"true"
|
||||
]
|
||||
|
||||
XCTAssertEqual(arguments, expectedArguments)
|
||||
|
@ -0,0 +1,98 @@
|
||||
//
|
||||
// StringsConfigurationTests.swift
|
||||
// ResgenSwift
|
||||
//
|
||||
// Created by Thibaut Schmitt on 18/07/2025.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
@testable import ResgenSwift
|
||||
import XCTest
|
||||
|
||||
final class StringsConfigurationTests: XCTestCase {
|
||||
|
||||
let projectDirectory = "projectDirectory/"
|
||||
|
||||
func test_argsGeneration_requiredArgs() {
|
||||
// Given
|
||||
let testingConfiguration = StringsConfiguration(
|
||||
inputFile: "path/to/strings.txt",
|
||||
outputPath: "Strings/Generated",
|
||||
langs: "fr en en-us",
|
||||
defaultLang: "en",
|
||||
extensionOutputPath: nil, // Strings/Generated
|
||||
extensionName: nil, // String
|
||||
extensionSuffix: nil, // Testing
|
||||
visibility: nil, // "internal"
|
||||
staticMembers: nil, // true
|
||||
xcStrings: nil // true
|
||||
)
|
||||
|
||||
// When
|
||||
let arguments = testingConfiguration.getArguments(
|
||||
projectDirectory: projectDirectory,
|
||||
force: false
|
||||
)
|
||||
|
||||
// Expect
|
||||
let expectedArguments = [
|
||||
"projectDirectory/path/to/strings.txt",
|
||||
"--output-path",
|
||||
"projectDirectory/Strings/Generated",
|
||||
"--langs",
|
||||
"fr en en-us",
|
||||
"--default-lang",
|
||||
"en"
|
||||
]
|
||||
|
||||
XCTAssertEqual(arguments, expectedArguments)
|
||||
}
|
||||
|
||||
func test_argsGeneration_allArguments() {
|
||||
// Given
|
||||
let testingConfiguration = StringsConfiguration(
|
||||
inputFile: "path/to/strings.txt",
|
||||
outputPath: "Strings/Generated",
|
||||
langs: "fr en en-us",
|
||||
defaultLang: "en",
|
||||
extensionOutputPath: "Strings/Generated",
|
||||
extensionName: "AppString",
|
||||
extensionSuffix: "Testing",
|
||||
visibility: "internal",
|
||||
staticMembers: true,
|
||||
xcStrings: true
|
||||
)
|
||||
|
||||
// When
|
||||
let arguments = testingConfiguration.getArguments(
|
||||
projectDirectory: projectDirectory,
|
||||
force: true
|
||||
)
|
||||
|
||||
// Expect
|
||||
let expectedArguments = [
|
||||
"-f",
|
||||
"projectDirectory/path/to/strings.txt",
|
||||
"--output-path",
|
||||
"projectDirectory/Strings/Generated",
|
||||
"--langs",
|
||||
"fr en en-us",
|
||||
"--default-lang",
|
||||
"en",
|
||||
"--extension-output-path",
|
||||
"projectDirectory/Strings/Generated",
|
||||
"--extension-name",
|
||||
"AppString",
|
||||
"--extension-suffix",
|
||||
"Testing",
|
||||
"--visibility",
|
||||
"internal",
|
||||
"--xc-strings",
|
||||
"true",
|
||||
"--static-members",
|
||||
"true"
|
||||
]
|
||||
|
||||
XCTAssertEqual(arguments, expectedArguments)
|
||||
}
|
||||
}
|
84
Tests/ResgenSwiftTests/Generate/TagsConfigurationTests.swift
Normal file
84
Tests/ResgenSwiftTests/Generate/TagsConfigurationTests.swift
Normal file
@ -0,0 +1,84 @@
|
||||
//
|
||||
// TagsConfigurationTests.swift
|
||||
// ResgenSwift
|
||||
//
|
||||
// Created by Thibaut Schmitt on 18/07/2025.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
@testable import ResgenSwift
|
||||
import XCTest
|
||||
|
||||
final class TagsConfigurationTests: XCTestCase {
|
||||
|
||||
let projectDirectory = "projectDirectory/"
|
||||
|
||||
func test_argsGeneration_requiredArgs() {
|
||||
// Given
|
||||
let testingConfiguration = TagsConfiguration(
|
||||
inputFile: "path/to/tags.txt",
|
||||
lang: "ium",
|
||||
extensionOutputPath: "Tags/Generated",
|
||||
extensionName: nil,
|
||||
extensionSuffix: nil,
|
||||
visibility: nil,
|
||||
staticMembers: nil
|
||||
)
|
||||
|
||||
// When
|
||||
let arguments = testingConfiguration.getArguments(
|
||||
projectDirectory: projectDirectory,
|
||||
force: false
|
||||
)
|
||||
|
||||
// Expect
|
||||
let expectedArguments = [
|
||||
"projectDirectory/path/to/tags.txt",
|
||||
"--lang",
|
||||
"ium",
|
||||
"--extension-output-path",
|
||||
"projectDirectory/Tags/Generated"
|
||||
]
|
||||
|
||||
XCTAssertEqual(arguments, expectedArguments)
|
||||
}
|
||||
|
||||
func test_argsGeneration_allArguments() {
|
||||
// Given
|
||||
let testingConfiguration = TagsConfiguration(
|
||||
inputFile: "path/to/tags.txt",
|
||||
lang: "ium",
|
||||
extensionOutputPath: "Tags/Generated",
|
||||
extensionName: "AppTag",
|
||||
extensionSuffix: "Testing",
|
||||
visibility: "private",
|
||||
staticMembers: true
|
||||
)
|
||||
|
||||
// When
|
||||
let arguments = testingConfiguration.getArguments(
|
||||
projectDirectory: projectDirectory,
|
||||
force: true
|
||||
)
|
||||
|
||||
// Expect
|
||||
let expectedArguments = [
|
||||
"-f",
|
||||
"projectDirectory/path/to/tags.txt",
|
||||
"--lang",
|
||||
"ium",
|
||||
"--extension-output-path",
|
||||
"projectDirectory/Tags/Generated",
|
||||
"--extension-name",
|
||||
"AppTag",
|
||||
"--extension-suffix",
|
||||
"Testing",
|
||||
"--visibility",
|
||||
"private",
|
||||
"--static-members",
|
||||
"true"
|
||||
]
|
||||
|
||||
XCTAssertEqual(arguments, expectedArguments)
|
||||
}
|
||||
}
|
@ -21,11 +21,14 @@ final class ImageExtensionGeneratorTests: XCTestCase {
|
||||
]
|
||||
|
||||
// When
|
||||
let extensionContent = ImageExtensionGenerator.getExtensionContent(images: images,
|
||||
staticVar: false,
|
||||
extensionName: "GenImages",
|
||||
inputFilename: "myInputFilename",
|
||||
isSwiftUI: false)
|
||||
let extensionContent = ImageExtensionGenerator.getExtensionContent(
|
||||
images: images,
|
||||
staticVar: false,
|
||||
extensionName: "GenImages",
|
||||
inputFilename: "myInputFilename",
|
||||
isSwiftUI: false,
|
||||
visibility: .public
|
||||
)
|
||||
|
||||
// Expect
|
||||
let expect = """
|
||||
@ -36,11 +39,11 @@ final class ImageExtensionGeneratorTests: XCTestCase {
|
||||
|
||||
extension GenImages {
|
||||
|
||||
var image_one: UIImage {
|
||||
public var image_one: UIImage {
|
||||
UIImage(named: "image_one")!
|
||||
}
|
||||
|
||||
var image_two: UIImage {
|
||||
public var image_two: UIImage {
|
||||
UIImage(named: "image_two")!
|
||||
}
|
||||
}
|
||||
@ -57,11 +60,14 @@ final class ImageExtensionGeneratorTests: XCTestCase {
|
||||
]
|
||||
|
||||
// When
|
||||
let extensionContent = ImageExtensionGenerator.getExtensionContent(images: images,
|
||||
staticVar: true,
|
||||
extensionName: "GenImages",
|
||||
inputFilename: "myInputFilename",
|
||||
isSwiftUI: false)
|
||||
let extensionContent = ImageExtensionGenerator.getExtensionContent(
|
||||
images: images,
|
||||
staticVar: true,
|
||||
extensionName: "GenImages",
|
||||
inputFilename: "myInputFilename",
|
||||
isSwiftUI: false,
|
||||
visibility: .internal
|
||||
)
|
||||
|
||||
// Expect
|
||||
let expect = """
|
||||
@ -72,11 +78,11 @@ final class ImageExtensionGeneratorTests: XCTestCase {
|
||||
|
||||
extension GenImages {
|
||||
|
||||
static var image_one: UIImage {
|
||||
internal static var image_one: UIImage {
|
||||
UIImage(named: "image_one")!
|
||||
}
|
||||
|
||||
static var image_two: UIImage {
|
||||
internal static var image_two: UIImage {
|
||||
UIImage(named: "image_two")!
|
||||
}
|
||||
}
|
||||
@ -93,11 +99,14 @@ final class ImageExtensionGeneratorTests: XCTestCase {
|
||||
]
|
||||
|
||||
// When
|
||||
let extensionContent = ImageExtensionGenerator.getExtensionContent(images: images,
|
||||
staticVar: false,
|
||||
extensionName: "GenImages",
|
||||
inputFilename: "myInputFilename",
|
||||
isSwiftUI: true)
|
||||
let extensionContent = ImageExtensionGenerator.getExtensionContent(
|
||||
images: images,
|
||||
staticVar: false,
|
||||
extensionName: "GenImages",
|
||||
inputFilename: "myInputFilename",
|
||||
isSwiftUI: true,
|
||||
visibility: .public
|
||||
)
|
||||
|
||||
// Expect
|
||||
let expect = """
|
||||
@ -108,11 +117,11 @@ final class ImageExtensionGeneratorTests: XCTestCase {
|
||||
|
||||
extension GenImages {
|
||||
|
||||
var image_one: Image {
|
||||
public var image_one: Image {
|
||||
Image("image_one")
|
||||
}
|
||||
|
||||
var image_two: Image {
|
||||
public var image_two: Image {
|
||||
Image("image_two")
|
||||
}
|
||||
}
|
||||
@ -129,11 +138,14 @@ final class ImageExtensionGeneratorTests: XCTestCase {
|
||||
]
|
||||
|
||||
// When
|
||||
let extensionContent = ImageExtensionGenerator.getExtensionContent(images: images,
|
||||
staticVar: true,
|
||||
extensionName: "GenImages",
|
||||
inputFilename: "myInputFilename",
|
||||
isSwiftUI: true)
|
||||
let extensionContent = ImageExtensionGenerator.getExtensionContent(
|
||||
images: images,
|
||||
staticVar: true,
|
||||
extensionName: "GenImages",
|
||||
inputFilename: "myInputFilename",
|
||||
isSwiftUI: true,
|
||||
visibility: .package
|
||||
)
|
||||
|
||||
// Expect
|
||||
let expect = """
|
||||
@ -144,11 +156,11 @@ final class ImageExtensionGeneratorTests: XCTestCase {
|
||||
|
||||
extension GenImages {
|
||||
|
||||
static var image_one: Image {
|
||||
package static var image_one: Image {
|
||||
Image("image_one")
|
||||
}
|
||||
|
||||
static var image_two: Image {
|
||||
package static var image_two: Image {
|
||||
Image("image_two")
|
||||
}
|
||||
}
|
||||
|
@ -37,17 +37,23 @@ final class ParsedImageTests: XCTestCase {
|
||||
func test_uiKit_GeneratedProperty() {
|
||||
// Given
|
||||
let imageName = "the_name"
|
||||
let parsedImage = ParsedImage(name: imageName,
|
||||
tags: "id",
|
||||
width: 10,
|
||||
height: 10)
|
||||
let parsedImage = ParsedImage(
|
||||
name: imageName,
|
||||
tags: "id",
|
||||
width: 10,
|
||||
height: 10
|
||||
)
|
||||
|
||||
// When
|
||||
let property = parsedImage.getImageProperty(isStatic: false, isSwiftUI: false)
|
||||
let property = parsedImage.getImageProperty(
|
||||
isStatic: false,
|
||||
isSwiftUI: false,
|
||||
visibility: .public
|
||||
)
|
||||
|
||||
// Expect
|
||||
let expect = """
|
||||
var \(imageName): UIImage {
|
||||
public var \(imageName): UIImage {
|
||||
UIImage(named: "\(imageName)")!
|
||||
}
|
||||
"""
|
||||
@ -58,17 +64,23 @@ final class ParsedImageTests: XCTestCase {
|
||||
func test_uiKit_GeneratedStaticProperty() {
|
||||
// Given
|
||||
let imageName = "the_name"
|
||||
let parsedImage = ParsedImage(name: imageName,
|
||||
tags: "id",
|
||||
width: 10,
|
||||
height: 10)
|
||||
let parsedImage = ParsedImage(
|
||||
name: imageName,
|
||||
tags: "id",
|
||||
width: 10,
|
||||
height: 10
|
||||
)
|
||||
|
||||
// When
|
||||
let property = parsedImage.getImageProperty(isStatic: true, isSwiftUI: false)
|
||||
let property = parsedImage.getImageProperty(
|
||||
isStatic: true,
|
||||
isSwiftUI: false,
|
||||
visibility: .internal
|
||||
)
|
||||
|
||||
// Expect
|
||||
let expect = """
|
||||
static var \(imageName): UIImage {
|
||||
internal static var \(imageName): UIImage {
|
||||
UIImage(named: "\(imageName)")!
|
||||
}
|
||||
"""
|
||||
@ -79,17 +91,23 @@ final class ParsedImageTests: XCTestCase {
|
||||
func test_swiftUI_GeneratedProperty() {
|
||||
// Given
|
||||
let imageName = "the_name"
|
||||
let parsedImage = ParsedImage(name: imageName,
|
||||
tags: "id",
|
||||
width: 10,
|
||||
height: 10)
|
||||
let parsedImage = ParsedImage(
|
||||
name: imageName,
|
||||
tags: "id",
|
||||
width: 10,
|
||||
height: 10
|
||||
)
|
||||
|
||||
// When
|
||||
let property = parsedImage.getImageProperty(isStatic: false, isSwiftUI: true)
|
||||
let property = parsedImage.getImageProperty(
|
||||
isStatic: false,
|
||||
isSwiftUI: true,
|
||||
visibility: .private
|
||||
)
|
||||
|
||||
// Expect
|
||||
let expect = """
|
||||
var \(imageName): Image {
|
||||
private var \(imageName): Image {
|
||||
Image("\(imageName)")
|
||||
}
|
||||
"""
|
||||
@ -100,17 +118,23 @@ final class ParsedImageTests: XCTestCase {
|
||||
func test_swiftUI_GeneratedStaticProperty() {
|
||||
// Given
|
||||
let imageName = "the_name"
|
||||
let parsedImage = ParsedImage(name: imageName,
|
||||
tags: "id",
|
||||
width: 10,
|
||||
height: 10)
|
||||
let parsedImage = ParsedImage(
|
||||
name: imageName,
|
||||
tags: "id",
|
||||
width: 10,
|
||||
height: 10
|
||||
)
|
||||
|
||||
// When
|
||||
let property = parsedImage.getImageProperty(isStatic: true, isSwiftUI: true)
|
||||
let property = parsedImage.getImageProperty(
|
||||
isStatic: true,
|
||||
isSwiftUI: true,
|
||||
visibility: .package
|
||||
)
|
||||
|
||||
// Expect
|
||||
let expect = """
|
||||
static var \(imageName): Image {
|
||||
package static var \(imageName): Image {
|
||||
Image("\(imageName)")
|
||||
}
|
||||
"""
|
||||
@ -121,10 +145,12 @@ final class ParsedImageTests: XCTestCase {
|
||||
func testAssetContentJson() {
|
||||
// Given
|
||||
let imageName = "the_name"
|
||||
let parsedImage = ParsedImage(name: imageName,
|
||||
tags: "id",
|
||||
width: 10,
|
||||
height: 10)
|
||||
let parsedImage = ParsedImage(
|
||||
name: imageName,
|
||||
tags: "id",
|
||||
width: 10,
|
||||
height: 10
|
||||
)
|
||||
|
||||
// When
|
||||
let property = parsedImage.generateImageContent(isVector: false)
|
||||
|
@ -8,9 +8,9 @@
|
||||
// CPD-OFF
|
||||
|
||||
import Foundation
|
||||
import XCTest
|
||||
|
||||
@testable import ResgenSwift
|
||||
import ToolCore
|
||||
import XCTest
|
||||
|
||||
final class DefinitionTests: XCTestCase {
|
||||
|
||||
@ -94,9 +94,9 @@ final class DefinitionTests: XCTestCase {
|
||||
]
|
||||
|
||||
// When
|
||||
let propertyFr = definition.getNSLocalizedStringProperty(forLang: "fr")
|
||||
let propertyEn = definition.getNSLocalizedStringProperty(forLang: "en")
|
||||
let propertyEnUs = definition.getNSLocalizedStringProperty(forLang: "en-us")
|
||||
let propertyFr = definition.getNSLocalizedStringProperty(forLang: "fr", visibility: .public)
|
||||
let propertyEn = definition.getNSLocalizedStringProperty(forLang: "en", visibility: .public)
|
||||
let propertyEnUs = definition.getNSLocalizedStringProperty(forLang: "en-us", visibility: .public)
|
||||
|
||||
// Expect
|
||||
let expectFr = """
|
||||
@ -105,7 +105,7 @@ final class DefinitionTests: XCTestCase {
|
||||
///
|
||||
/// Comment :
|
||||
/// This is a comment
|
||||
var definition_name: String {
|
||||
public var definition_name: String {
|
||||
NSLocalizedString("definition_name", tableName: kStringsFileName, bundle: Bundle.main, value: "C'est la traduction francaise", comment: "This is a comment")
|
||||
}
|
||||
"""
|
||||
@ -116,7 +116,7 @@ final class DefinitionTests: XCTestCase {
|
||||
///
|
||||
/// Comment :
|
||||
/// This is a comment
|
||||
var definition_name: String {
|
||||
public var definition_name: String {
|
||||
NSLocalizedString("definition_name", tableName: kStringsFileName, bundle: Bundle.main, value: "This is the english translation", comment: "This is a comment")
|
||||
}
|
||||
"""
|
||||
@ -127,7 +127,7 @@ final class DefinitionTests: XCTestCase {
|
||||
///
|
||||
/// Comment :
|
||||
/// This is a comment
|
||||
var definition_name: String {
|
||||
public var definition_name: String {
|
||||
NSLocalizedString("definition_name", tableName: kStringsFileName, bundle: Bundle.main, value: "This is the english us translation", comment: "This is a comment")
|
||||
}
|
||||
"""
|
||||
@ -149,9 +149,9 @@ final class DefinitionTests: XCTestCase {
|
||||
]
|
||||
|
||||
// When
|
||||
let propertyFr = definition.getNSLocalizedStringProperty(forLang: "fr")
|
||||
let propertyEn = definition.getNSLocalizedStringProperty(forLang: "en")
|
||||
let propertyEnUs = definition.getNSLocalizedStringProperty(forLang: "en-us")
|
||||
let propertyFr = definition.getNSLocalizedStringProperty(forLang: "fr", visibility: .private)
|
||||
let propertyEn = definition.getNSLocalizedStringProperty(forLang: "en", visibility: .private)
|
||||
let propertyEnUs = definition.getNSLocalizedStringProperty(forLang: "en-us", visibility: .private)
|
||||
|
||||
// Expect
|
||||
let expectFr = """
|
||||
@ -160,7 +160,7 @@ final class DefinitionTests: XCTestCase {
|
||||
///
|
||||
/// Comment :
|
||||
/// No comment
|
||||
var definition_name: String {
|
||||
private var definition_name: String {
|
||||
NSLocalizedString("definition_name", tableName: kStringsFileName, bundle: Bundle.main, value: "C'est la traduction francaise", comment: "")
|
||||
}
|
||||
"""
|
||||
@ -171,7 +171,7 @@ final class DefinitionTests: XCTestCase {
|
||||
///
|
||||
/// Comment :
|
||||
/// No comment
|
||||
var definition_name: String {
|
||||
private var definition_name: String {
|
||||
NSLocalizedString("definition_name", tableName: kStringsFileName, bundle: Bundle.main, value: "This is the english translation", comment: "")
|
||||
}
|
||||
"""
|
||||
@ -182,7 +182,7 @@ final class DefinitionTests: XCTestCase {
|
||||
///
|
||||
/// Comment :
|
||||
/// No comment
|
||||
var definition_name: String {
|
||||
private var definition_name: String {
|
||||
NSLocalizedString("definition_name", tableName: kStringsFileName, bundle: Bundle.main, value: "This is the english us translation", comment: "")
|
||||
}
|
||||
"""
|
||||
@ -203,9 +203,9 @@ final class DefinitionTests: XCTestCase {
|
||||
]
|
||||
|
||||
// When
|
||||
let propertyFr = definition.getNSLocalizedStringProperty(forLang: "fr")
|
||||
let propertyEn = definition.getNSLocalizedStringProperty(forLang: "en")
|
||||
let propertyEnUs = definition.getNSLocalizedStringProperty(forLang: "en-us")
|
||||
let propertyFr = definition.getNSLocalizedStringProperty(forLang: "fr", visibility: .public)
|
||||
let propertyEn = definition.getNSLocalizedStringProperty(forLang: "en", visibility: .public)
|
||||
let propertyEnUs = definition.getNSLocalizedStringProperty(forLang: "en-us", visibility: .public)
|
||||
|
||||
// Expect
|
||||
let expectFr = """
|
||||
@ -214,7 +214,7 @@ final class DefinitionTests: XCTestCase {
|
||||
///
|
||||
/// Comment :
|
||||
/// No comment
|
||||
var definition_name: String {
|
||||
public var definition_name: String {
|
||||
NSLocalizedString("definition_name", tableName: kStringsFileName, bundle: Bundle.main, value: "C'est la traduction francaise", comment: "")
|
||||
}
|
||||
"""
|
||||
@ -225,7 +225,7 @@ final class DefinitionTests: XCTestCase {
|
||||
///
|
||||
/// Comment :
|
||||
/// No comment
|
||||
var definition_name: String {
|
||||
public var definition_name: String {
|
||||
NSLocalizedString("definition_name", tableName: kStringsFileName, bundle: Bundle.main, value: "This is the english translation", comment: "")
|
||||
}
|
||||
"""
|
||||
@ -236,7 +236,7 @@ final class DefinitionTests: XCTestCase {
|
||||
///
|
||||
/// Comment :
|
||||
/// No comment
|
||||
var definition_name: String {
|
||||
public var definition_name: String {
|
||||
NSLocalizedString("definition_name", tableName: kStringsFileName, bundle: Bundle.main, value: "This is the english us translation", comment: "")
|
||||
}
|
||||
"""
|
||||
@ -260,10 +260,10 @@ final class DefinitionTests: XCTestCase {
|
||||
]
|
||||
|
||||
// When
|
||||
let propertyFr = definition.getNSLocalizedStringStaticProperty(forLang: "fr")
|
||||
let propertyEn = definition.getNSLocalizedStringStaticProperty(forLang: "en")
|
||||
let propertyEnUs = definition.getNSLocalizedStringStaticProperty(forLang: "en-us")
|
||||
|
||||
let propertyFr = definition.getNSLocalizedStringStaticProperty(forLang: "fr", visibility: .public)
|
||||
let propertyEn = definition.getNSLocalizedStringStaticProperty(forLang: "en", visibility: .public)
|
||||
let propertyEnUs = definition.getNSLocalizedStringStaticProperty(forLang: "en-us", visibility: .public)
|
||||
|
||||
// Expect
|
||||
let expectFr = """
|
||||
/// Translation in fr :
|
||||
@ -271,7 +271,7 @@ final class DefinitionTests: XCTestCase {
|
||||
///
|
||||
/// Comment :
|
||||
/// This is a comment
|
||||
static var definition_name: String {
|
||||
public static var definition_name: String {
|
||||
NSLocalizedString("definition_name", tableName: kStringsFileName, bundle: Bundle.main, value: "C'est la traduction francaise", comment: "This is a comment")
|
||||
}
|
||||
"""
|
||||
@ -282,7 +282,7 @@ final class DefinitionTests: XCTestCase {
|
||||
///
|
||||
/// Comment :
|
||||
/// This is a comment
|
||||
static var definition_name: String {
|
||||
public static var definition_name: String {
|
||||
NSLocalizedString("definition_name", tableName: kStringsFileName, bundle: Bundle.main, value: "This is the english translation", comment: "This is a comment")
|
||||
}
|
||||
"""
|
||||
@ -293,7 +293,7 @@ final class DefinitionTests: XCTestCase {
|
||||
///
|
||||
/// Comment :
|
||||
/// This is a comment
|
||||
static var definition_name: String {
|
||||
public static var definition_name: String {
|
||||
NSLocalizedString("definition_name", tableName: kStringsFileName, bundle: Bundle.main, value: "This is the english us translation", comment: "This is a comment")
|
||||
}
|
||||
"""
|
||||
@ -315,9 +315,9 @@ final class DefinitionTests: XCTestCase {
|
||||
]
|
||||
|
||||
// When
|
||||
let propertyFr = definition.getNSLocalizedStringStaticProperty(forLang: "fr")
|
||||
let propertyEn = definition.getNSLocalizedStringStaticProperty(forLang: "en")
|
||||
let propertyEnUs = definition.getNSLocalizedStringStaticProperty(forLang: "en-us")
|
||||
let propertyFr = definition.getNSLocalizedStringStaticProperty(forLang: "fr", visibility: .internal)
|
||||
let propertyEn = definition.getNSLocalizedStringStaticProperty(forLang: "en", visibility: .internal)
|
||||
let propertyEnUs = definition.getNSLocalizedStringStaticProperty(forLang: "en-us", visibility: .internal)
|
||||
|
||||
// Expect
|
||||
let expectFr = """
|
||||
@ -326,7 +326,7 @@ final class DefinitionTests: XCTestCase {
|
||||
///
|
||||
/// Comment :
|
||||
/// No comment
|
||||
static var definition_name: String {
|
||||
internal static var definition_name: String {
|
||||
NSLocalizedString("definition_name", tableName: kStringsFileName, bundle: Bundle.main, value: "C'est la traduction francaise", comment: "")
|
||||
}
|
||||
"""
|
||||
@ -337,7 +337,7 @@ final class DefinitionTests: XCTestCase {
|
||||
///
|
||||
/// Comment :
|
||||
/// No comment
|
||||
static var definition_name: String {
|
||||
internal static var definition_name: String {
|
||||
NSLocalizedString("definition_name", tableName: kStringsFileName, bundle: Bundle.main, value: "This is the english translation", comment: "")
|
||||
}
|
||||
"""
|
||||
@ -348,7 +348,7 @@ final class DefinitionTests: XCTestCase {
|
||||
///
|
||||
/// Comment :
|
||||
/// No comment
|
||||
static var definition_name: String {
|
||||
internal static var definition_name: String {
|
||||
NSLocalizedString("definition_name", tableName: kStringsFileName, bundle: Bundle.main, value: "This is the english us translation", comment: "")
|
||||
}
|
||||
"""
|
||||
@ -369,9 +369,9 @@ final class DefinitionTests: XCTestCase {
|
||||
]
|
||||
|
||||
// When
|
||||
let propertyFr = definition.getNSLocalizedStringStaticProperty(forLang: "fr")
|
||||
let propertyEn = definition.getNSLocalizedStringStaticProperty(forLang: "en")
|
||||
let propertyEnUs = definition.getNSLocalizedStringStaticProperty(forLang: "en-us")
|
||||
let propertyFr = definition.getNSLocalizedStringStaticProperty(forLang: "fr", visibility: .internal)
|
||||
let propertyEn = definition.getNSLocalizedStringStaticProperty(forLang: "en", visibility: .internal)
|
||||
let propertyEnUs = definition.getNSLocalizedStringStaticProperty(forLang: "en-us", visibility: .internal)
|
||||
|
||||
// Expect
|
||||
let expectFr = """
|
||||
@ -380,7 +380,7 @@ final class DefinitionTests: XCTestCase {
|
||||
///
|
||||
/// Comment :
|
||||
/// No comment
|
||||
static var definition_name: String {
|
||||
internal static var definition_name: String {
|
||||
NSLocalizedString("definition_name", tableName: kStringsFileName, bundle: Bundle.main, value: "C'est la traduction francaise", comment: "")
|
||||
}
|
||||
"""
|
||||
@ -391,7 +391,7 @@ final class DefinitionTests: XCTestCase {
|
||||
///
|
||||
/// Comment :
|
||||
/// No comment
|
||||
static var definition_name: String {
|
||||
internal static var definition_name: String {
|
||||
NSLocalizedString("definition_name", tableName: kStringsFileName, bundle: Bundle.main, value: "This is the english translation", comment: "")
|
||||
}
|
||||
"""
|
||||
@ -402,7 +402,7 @@ final class DefinitionTests: XCTestCase {
|
||||
///
|
||||
/// Comment :
|
||||
/// No comment
|
||||
static var definition_name: String {
|
||||
internal static var definition_name: String {
|
||||
NSLocalizedString("definition_name", tableName: kStringsFileName, bundle: Bundle.main, value: "This is the english us translation", comment: "")
|
||||
}
|
||||
"""
|
||||
@ -422,8 +422,8 @@ final class DefinitionTests: XCTestCase {
|
||||
]
|
||||
|
||||
// When
|
||||
let propertyFr = definition.getNSLocalizedStringProperty(forLang: "fr")
|
||||
|
||||
let propertyFr = definition.getNSLocalizedStringProperty(forLang: "fr", visibility: .internal)
|
||||
|
||||
// Expect
|
||||
let expectFr = """
|
||||
/// Translation in fr :
|
||||
@ -431,7 +431,7 @@ final class DefinitionTests: XCTestCase {
|
||||
///
|
||||
/// Comment :
|
||||
/// This is a comment
|
||||
var definition_name: String {
|
||||
internal var definition_name: String {
|
||||
NSLocalizedString("definition_name", tableName: kStringsFileName, bundle: Bundle.main, value: "Welcome \"%@\" !", comment: "This is a comment")
|
||||
}
|
||||
|
||||
@ -440,7 +440,7 @@ final class DefinitionTests: XCTestCase {
|
||||
///
|
||||
/// Comment :
|
||||
/// This is a comment
|
||||
func definition_name(arg0: String) -> String {
|
||||
internal func definition_name(arg0: String) -> String {
|
||||
String(format: self.definition_name, arg0)
|
||||
}
|
||||
"""
|
||||
@ -458,8 +458,8 @@ final class DefinitionTests: XCTestCase {
|
||||
]
|
||||
|
||||
// When
|
||||
let propertyFr = definition.getNSLocalizedStringProperty(forLang: "fr")
|
||||
|
||||
let propertyFr = definition.getNSLocalizedStringProperty(forLang: "fr", visibility: .private)
|
||||
|
||||
// Expect
|
||||
let expectFr = """
|
||||
/// Translation in fr :
|
||||
@ -467,7 +467,7 @@ final class DefinitionTests: XCTestCase {
|
||||
///
|
||||
/// Comment :
|
||||
/// This is a comment
|
||||
var definition_name: String {
|
||||
private var definition_name: String {
|
||||
NSLocalizedString("definition_name", tableName: kStringsFileName, bundle: Bundle.main, value: "Welcome \"%@\" ! Your age is %d :) Your weight is %f ;-)", comment: "This is a comment")
|
||||
}
|
||||
|
||||
@ -476,7 +476,7 @@ final class DefinitionTests: XCTestCase {
|
||||
///
|
||||
/// Comment :
|
||||
/// This is a comment
|
||||
func definition_name(arg0: String, arg1: Int, arg2: Double) -> String {
|
||||
private func definition_name(arg0: String, arg1: Int, arg2: Double) -> String {
|
||||
String(format: self.definition_name, arg0, arg1, arg2)
|
||||
}
|
||||
"""
|
||||
@ -495,16 +495,16 @@ final class DefinitionTests: XCTestCase {
|
||||
]
|
||||
|
||||
// When
|
||||
let propertyFr = definition.getNSLocalizedStringProperty(forLang: "fr")
|
||||
let propertyEn = definition.getNSLocalizedStringProperty(forLang: "en")
|
||||
|
||||
let propertyFr = definition.getNSLocalizedStringProperty(forLang: "fr", visibility: .public)
|
||||
let propertyEn = definition.getNSLocalizedStringProperty(forLang: "en", visibility: .public)
|
||||
|
||||
let expectFr = """
|
||||
/// Translation in fr :
|
||||
/// Vous %%: %1$@ %2$@ Age: %3$d
|
||||
///
|
||||
/// Comment :
|
||||
/// This is a comment
|
||||
var definition_name: String {
|
||||
public var definition_name: String {
|
||||
NSLocalizedString("definition_name", tableName: kStringsFileName, bundle: Bundle.main, value: "Vous %%: %1$@ %2$@ Age: %3$d", comment: "This is a comment")
|
||||
}
|
||||
|
||||
@ -513,7 +513,7 @@ final class DefinitionTests: XCTestCase {
|
||||
///
|
||||
/// Comment :
|
||||
/// This is a comment
|
||||
func definition_name(arg0: String, arg1: String, arg2: Int) -> String {
|
||||
public func definition_name(arg0: String, arg1: String, arg2: Int) -> String {
|
||||
String(format: self.definition_name, arg0, arg1, arg2)
|
||||
}
|
||||
"""
|
||||
@ -524,7 +524,7 @@ final class DefinitionTests: XCTestCase {
|
||||
///
|
||||
/// Comment :
|
||||
/// This is a comment
|
||||
var definition_name: String {
|
||||
public var definition_name: String {
|
||||
NSLocalizedString("definition_name", tableName: kStringsFileName, bundle: Bundle.main, value: "You %%: %2$@ %1$@ Age: %3$d", comment: "This is a comment")
|
||||
}
|
||||
|
||||
@ -533,7 +533,7 @@ final class DefinitionTests: XCTestCase {
|
||||
///
|
||||
/// Comment :
|
||||
/// This is a comment
|
||||
func definition_name(arg0: String, arg1: String, arg2: Int) -> String {
|
||||
public func definition_name(arg0: String, arg1: String, arg2: Int) -> String {
|
||||
String(format: self.definition_name, arg0, arg1, arg2)
|
||||
}
|
||||
"""
|
||||
@ -556,10 +556,10 @@ final class DefinitionTests: XCTestCase {
|
||||
]
|
||||
|
||||
// When
|
||||
let propertyFr = definition.getProperty(forLang: "fr")
|
||||
let propertyEn = definition.getProperty(forLang: "en")
|
||||
let propertyEnUs = definition.getProperty(forLang: "en-us")
|
||||
|
||||
let propertyFr = definition.getProperty(forLang: "fr", visibility: .public)
|
||||
let propertyEn = definition.getProperty(forLang: "en", visibility: .public)
|
||||
let propertyEnUs = definition.getProperty(forLang: "en-us", visibility: .public)
|
||||
|
||||
// Expect
|
||||
let expectFr = """
|
||||
/// Translation in fr :
|
||||
@ -567,7 +567,7 @@ final class DefinitionTests: XCTestCase {
|
||||
///
|
||||
/// Comment :
|
||||
/// This is a comment
|
||||
var definition_name: String {
|
||||
public var definition_name: String {
|
||||
"C'est la traduction francaise"
|
||||
}
|
||||
"""
|
||||
@ -578,7 +578,7 @@ final class DefinitionTests: XCTestCase {
|
||||
///
|
||||
/// Comment :
|
||||
/// This is a comment
|
||||
var definition_name: String {
|
||||
public var definition_name: String {
|
||||
"This is the english translation"
|
||||
}
|
||||
"""
|
||||
@ -589,7 +589,7 @@ final class DefinitionTests: XCTestCase {
|
||||
///
|
||||
/// Comment :
|
||||
/// This is a comment
|
||||
var definition_name: String {
|
||||
public var definition_name: String {
|
||||
"This is the english us translation"
|
||||
}
|
||||
"""
|
||||
@ -611,9 +611,9 @@ final class DefinitionTests: XCTestCase {
|
||||
]
|
||||
|
||||
// When
|
||||
let propertyFr = definition.getProperty(forLang: "fr")
|
||||
let propertyEn = definition.getProperty(forLang: "en")
|
||||
let propertyEnUs = definition.getProperty(forLang: "en-us")
|
||||
let propertyFr = definition.getProperty(forLang: "fr", visibility: .package)
|
||||
let propertyEn = definition.getProperty(forLang: "en", visibility: .package)
|
||||
let propertyEnUs = definition.getProperty(forLang: "en-us", visibility: .package)
|
||||
|
||||
// Expect
|
||||
let expectFr = """
|
||||
@ -622,7 +622,7 @@ final class DefinitionTests: XCTestCase {
|
||||
///
|
||||
/// Comment :
|
||||
/// No comment
|
||||
var definition_name: String {
|
||||
package var definition_name: String {
|
||||
"C'est la traduction francaise"
|
||||
}
|
||||
"""
|
||||
@ -633,7 +633,7 @@ final class DefinitionTests: XCTestCase {
|
||||
///
|
||||
/// Comment :
|
||||
/// No comment
|
||||
var definition_name: String {
|
||||
package var definition_name: String {
|
||||
"This is the english translation"
|
||||
}
|
||||
"""
|
||||
@ -644,7 +644,7 @@ final class DefinitionTests: XCTestCase {
|
||||
///
|
||||
/// Comment :
|
||||
/// No comment
|
||||
var definition_name: String {
|
||||
package var definition_name: String {
|
||||
"This is the english us translation"
|
||||
}
|
||||
"""
|
||||
@ -665,9 +665,9 @@ final class DefinitionTests: XCTestCase {
|
||||
]
|
||||
|
||||
// When
|
||||
let propertyFr = definition.getProperty(forLang: "fr")
|
||||
let propertyEn = definition.getProperty(forLang: "en")
|
||||
let propertyEnUs = definition.getProperty(forLang: "en-us")
|
||||
let propertyFr = definition.getProperty(forLang: "fr", visibility: .private)
|
||||
let propertyEn = definition.getProperty(forLang: "en", visibility: .private)
|
||||
let propertyEnUs = definition.getProperty(forLang: "en-us", visibility: .private)
|
||||
|
||||
// Expect
|
||||
let expectFr = """
|
||||
@ -676,7 +676,7 @@ final class DefinitionTests: XCTestCase {
|
||||
///
|
||||
/// Comment :
|
||||
/// No comment
|
||||
var definition_name: String {
|
||||
private var definition_name: String {
|
||||
"C'est la traduction francaise"
|
||||
}
|
||||
"""
|
||||
@ -687,7 +687,7 @@ final class DefinitionTests: XCTestCase {
|
||||
///
|
||||
/// Comment :
|
||||
/// No comment
|
||||
var definition_name: String {
|
||||
private var definition_name: String {
|
||||
"This is the english translation"
|
||||
}
|
||||
"""
|
||||
@ -698,7 +698,7 @@ final class DefinitionTests: XCTestCase {
|
||||
///
|
||||
/// Comment :
|
||||
/// No comment
|
||||
var definition_name: String {
|
||||
private var definition_name: String {
|
||||
"This is the english us translation"
|
||||
}
|
||||
"""
|
||||
@ -722,10 +722,10 @@ final class DefinitionTests: XCTestCase {
|
||||
]
|
||||
|
||||
// When
|
||||
let propertyFr = definition.getStaticProperty(forLang: "fr")
|
||||
let propertyEn = definition.getStaticProperty(forLang: "en")
|
||||
let propertyEnUs = definition.getStaticProperty(forLang: "en-us")
|
||||
|
||||
let propertyFr = definition.getStaticProperty(forLang: "fr", visibility: .internal)
|
||||
let propertyEn = definition.getStaticProperty(forLang: "en", visibility: .internal)
|
||||
let propertyEnUs = definition.getStaticProperty(forLang: "en-us", visibility: .internal)
|
||||
|
||||
// Expect
|
||||
let expectFr = """
|
||||
/// Translation in fr :
|
||||
@ -733,7 +733,7 @@ final class DefinitionTests: XCTestCase {
|
||||
///
|
||||
/// Comment :
|
||||
/// This is a comment
|
||||
static var definition_name: String {
|
||||
internal static var definition_name: String {
|
||||
"C'est la traduction francaise"
|
||||
}
|
||||
"""
|
||||
@ -744,7 +744,7 @@ final class DefinitionTests: XCTestCase {
|
||||
///
|
||||
/// Comment :
|
||||
/// This is a comment
|
||||
static var definition_name: String {
|
||||
internal static var definition_name: String {
|
||||
"This is the english translation"
|
||||
}
|
||||
"""
|
||||
@ -755,7 +755,7 @@ final class DefinitionTests: XCTestCase {
|
||||
///
|
||||
/// Comment :
|
||||
/// This is a comment
|
||||
static var definition_name: String {
|
||||
internal static var definition_name: String {
|
||||
"This is the english us translation"
|
||||
}
|
||||
"""
|
||||
@ -777,9 +777,9 @@ final class DefinitionTests: XCTestCase {
|
||||
]
|
||||
|
||||
// When
|
||||
let propertyFr = definition.getStaticProperty(forLang: "fr")
|
||||
let propertyEn = definition.getStaticProperty(forLang: "en")
|
||||
let propertyEnUs = definition.getStaticProperty(forLang: "en-us")
|
||||
let propertyFr = definition.getStaticProperty(forLang: "fr", visibility: .internal)
|
||||
let propertyEn = definition.getStaticProperty(forLang: "en", visibility: .internal)
|
||||
let propertyEnUs = definition.getStaticProperty(forLang: "en-us", visibility: .internal)
|
||||
|
||||
// Expect
|
||||
let expectFr = """
|
||||
@ -788,7 +788,7 @@ final class DefinitionTests: XCTestCase {
|
||||
///
|
||||
/// Comment :
|
||||
/// No comment
|
||||
static var definition_name: String {
|
||||
internal static var definition_name: String {
|
||||
"C'est la traduction francaise"
|
||||
}
|
||||
"""
|
||||
@ -799,7 +799,7 @@ final class DefinitionTests: XCTestCase {
|
||||
///
|
||||
/// Comment :
|
||||
/// No comment
|
||||
static var definition_name: String {
|
||||
internal static var definition_name: String {
|
||||
"This is the english translation"
|
||||
}
|
||||
"""
|
||||
@ -810,7 +810,7 @@ final class DefinitionTests: XCTestCase {
|
||||
///
|
||||
/// Comment :
|
||||
/// No comment
|
||||
static var definition_name: String {
|
||||
internal static var definition_name: String {
|
||||
"This is the english us translation"
|
||||
}
|
||||
"""
|
||||
@ -831,9 +831,9 @@ final class DefinitionTests: XCTestCase {
|
||||
]
|
||||
|
||||
// When
|
||||
let propertyFr = definition.getStaticProperty(forLang: "fr")
|
||||
let propertyEn = definition.getStaticProperty(forLang: "en")
|
||||
let propertyEnUs = definition.getStaticProperty(forLang: "en-us")
|
||||
let propertyFr = definition.getStaticProperty(forLang: "fr", visibility: .internal)
|
||||
let propertyEn = definition.getStaticProperty(forLang: "en", visibility: .internal)
|
||||
let propertyEnUs = definition.getStaticProperty(forLang: "en-us", visibility: .internal)
|
||||
|
||||
// Expect
|
||||
let expectFr = """
|
||||
@ -842,7 +842,7 @@ final class DefinitionTests: XCTestCase {
|
||||
///
|
||||
/// Comment :
|
||||
/// No comment
|
||||
static var definition_name: String {
|
||||
internal static var definition_name: String {
|
||||
"C'est la traduction francaise"
|
||||
}
|
||||
"""
|
||||
@ -853,7 +853,7 @@ final class DefinitionTests: XCTestCase {
|
||||
///
|
||||
/// Comment :
|
||||
/// No comment
|
||||
static var definition_name: String {
|
||||
internal static var definition_name: String {
|
||||
"This is the english translation"
|
||||
}
|
||||
"""
|
||||
@ -864,7 +864,7 @@ final class DefinitionTests: XCTestCase {
|
||||
///
|
||||
/// Comment :
|
||||
/// No comment
|
||||
static var definition_name: String {
|
||||
internal static var definition_name: String {
|
||||
"This is the english us translation"
|
||||
}
|
||||
"""
|
||||
|
@ -20,6 +20,7 @@ extension StringsFileGeneratorTests {
|
||||
s2DefOneComment: String = "",
|
||||
s2DefTwoFr: String = "Section Deux - Definition Deux",
|
||||
s2DefTwoComment: String = "",
|
||||
visibility: ExtensionVisibility = .internal
|
||||
) -> String {
|
||||
"""
|
||||
// Generated by ResgenSwift.Strings.Stringium \(ResgenSwiftVersion)
|
||||
@ -30,13 +31,13 @@ extension StringsFileGeneratorTests {
|
||||
|
||||
extension GenStrings {
|
||||
|
||||
enum KeyStrings: String {
|
||||
\(visibility) 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> {
|
||||
\(visibility) 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
|
||||
@ -53,7 +54,7 @@ extension StringsFileGeneratorTests {
|
||||
///
|
||||
/// Comment :
|
||||
/// \(s1DefOneComment.isEmpty ? "No comment" : s1DefOneComment)
|
||||
\(staticVar ? "static " : "")var s1_def_one: String {
|
||||
\(visibility) \(staticVar ? "static " : "")var s1_def_one: String {
|
||||
NSLocalizedString("s1_def_one", tableName: kStringsFileName, bundle: Bundle.main, value: "Section Un - Definition Un", comment: "\(s1DefOneComment)")
|
||||
}
|
||||
|
||||
@ -62,7 +63,7 @@ extension StringsFileGeneratorTests {
|
||||
///
|
||||
/// Comment :
|
||||
/// \(s1DefTwoComment.isEmpty ? "No comment" : s1DefTwoComment)
|
||||
\(staticVar ? "static " : "")var s1_def_two: String {
|
||||
\(visibility) \(staticVar ? "static " : "")var s1_def_two: String {
|
||||
NSLocalizedString("s1_def_two", tableName: kStringsFileName, bundle: Bundle.main, value: "Section Un - Definition Deux", comment: "\(s1DefTwoComment)")
|
||||
}
|
||||
|
||||
@ -73,7 +74,7 @@ extension StringsFileGeneratorTests {
|
||||
///
|
||||
/// Comment :
|
||||
/// \(s2DefOneComment.isEmpty ? "No comment" : s2DefOneComment)
|
||||
\(staticVar ? "static " : "")var s2_def_one: String {
|
||||
\(visibility) \(staticVar ? "static " : "")var s2_def_one: String {
|
||||
NSLocalizedString("s2_def_one", tableName: kStringsFileName, bundle: Bundle.main, value: "Section Deux - Definition Un", comment: "\(s2DefOneComment)")
|
||||
}
|
||||
|
||||
@ -82,7 +83,7 @@ extension StringsFileGeneratorTests {
|
||||
///
|
||||
/// Comment :
|
||||
/// \(s2DefTwoComment.isEmpty ? "No comment" : s2DefTwoComment)
|
||||
\(staticVar ? "static " : "")var s2_def_two: String {
|
||||
\(visibility) \(staticVar ? "static " : "")var s2_def_two: String {
|
||||
NSLocalizedString("s2_def_two", tableName: kStringsFileName, bundle: Bundle.main, value: "Section Deux - Definition Deux", comment: "\(s2DefTwoComment)")
|
||||
}
|
||||
}
|
||||
|
@ -373,13 +373,16 @@ final class StringsFileGeneratorTests: XCTestCase {
|
||||
let sectionTwo = Section.Mock.getSectionTwo()
|
||||
|
||||
// When
|
||||
let extensionContent = StringsFileGenerator.getExtensionContent(sections: [sectionOne, sectionTwo],
|
||||
defaultLang: "fr",
|
||||
tags: ["ios", "iosonly", "notranslation"],
|
||||
staticVar: false,
|
||||
inputFilename: "myInputFilename",
|
||||
extensionName: "GenStrings",
|
||||
extensionSuffix: "strings")
|
||||
let extensionContent = StringsFileGenerator.getExtensionContent(
|
||||
sections: [sectionOne, sectionTwo],
|
||||
defaultLang: "fr",
|
||||
tags: ["ios", "iosonly", "notranslation"],
|
||||
staticVar: false,
|
||||
inputFilename: "myInputFilename",
|
||||
extensionName: "GenStrings",
|
||||
extensionSuffix: "strings",
|
||||
visibility: .internal
|
||||
)
|
||||
|
||||
// Expect
|
||||
let expect = Self.getExtensionContentExpectation(
|
||||
@ -404,13 +407,16 @@ final class StringsFileGeneratorTests: XCTestCase {
|
||||
)
|
||||
|
||||
// When
|
||||
let extensionContent = StringsFileGenerator.getExtensionContent(sections: [sectionOne, sectionTwo],
|
||||
defaultLang: "fr",
|
||||
tags: ["ios", "iosonly", "notranslation"],
|
||||
staticVar: false,
|
||||
inputFilename: "myInputFilename",
|
||||
extensionName: "GenStrings",
|
||||
extensionSuffix: "strings")
|
||||
let extensionContent = StringsFileGenerator.getExtensionContent(
|
||||
sections: [sectionOne, sectionTwo],
|
||||
defaultLang: "fr",
|
||||
tags: ["ios", "iosonly", "notranslation"],
|
||||
staticVar: false,
|
||||
inputFilename: "myInputFilename",
|
||||
extensionName: "GenStrings",
|
||||
extensionSuffix: "strings",
|
||||
visibility: .public
|
||||
)
|
||||
|
||||
// Expect
|
||||
let expect = Self.getExtensionContentExpectation(
|
||||
@ -419,6 +425,7 @@ final class StringsFileGeneratorTests: XCTestCase {
|
||||
s1DefTwoComment: "This is a comment",
|
||||
s2DefOneComment: "This is a comment",
|
||||
s2DefTwoComment: "This is a comment",
|
||||
visibility: .public
|
||||
)
|
||||
|
||||
if extensionContent != expect {
|
||||
@ -434,17 +441,21 @@ final class StringsFileGeneratorTests: XCTestCase {
|
||||
let sectionTwo = Section.Mock.getSectionTwo()
|
||||
|
||||
// When
|
||||
let extensionContent = StringsFileGenerator.getExtensionContent(sections: [sectionOne, sectionTwo],
|
||||
defaultLang: "fr",
|
||||
tags: ["ios", "iosonly", "notranslation"],
|
||||
staticVar: true,
|
||||
inputFilename: "myInputFilename",
|
||||
extensionName: "GenStrings",
|
||||
extensionSuffix: "strings")
|
||||
let extensionContent = StringsFileGenerator.getExtensionContent(
|
||||
sections: [sectionOne, sectionTwo],
|
||||
defaultLang: "fr",
|
||||
tags: ["ios", "iosonly", "notranslation"],
|
||||
staticVar: true,
|
||||
inputFilename: "myInputFilename",
|
||||
extensionName: "GenStrings",
|
||||
extensionSuffix: "strings",
|
||||
visibility: .package
|
||||
)
|
||||
|
||||
// Expect
|
||||
let expect = Self.getExtensionContentExpectation(
|
||||
staticVar: true
|
||||
staticVar: true,
|
||||
visibility: .package
|
||||
)
|
||||
|
||||
if extensionContent != expect {
|
||||
@ -465,13 +476,16 @@ final class StringsFileGeneratorTests: XCTestCase {
|
||||
)
|
||||
|
||||
// When
|
||||
let extensionContent = StringsFileGenerator.getExtensionContent(sections: [sectionOne, sectionTwo],
|
||||
defaultLang: "fr",
|
||||
tags: ["ios", "iosonly", "notranslation"],
|
||||
staticVar: true,
|
||||
inputFilename: "myInputFilename",
|
||||
extensionName: "GenStrings",
|
||||
extensionSuffix: "strings")
|
||||
let extensionContent = StringsFileGenerator.getExtensionContent(
|
||||
sections: [sectionOne, sectionTwo],
|
||||
defaultLang: "fr",
|
||||
tags: ["ios", "iosonly", "notranslation"],
|
||||
staticVar: true,
|
||||
inputFilename: "myInputFilename",
|
||||
extensionName: "GenStrings",
|
||||
extensionSuffix: "strings",
|
||||
visibility: .internal
|
||||
)
|
||||
|
||||
// Expect
|
||||
let expect = Self.getExtensionContentExpectation(
|
||||
@ -480,6 +494,7 @@ final class StringsFileGeneratorTests: XCTestCase {
|
||||
s1DefTwoComment: "This is a comment",
|
||||
s2DefOneComment: "This is a comment",
|
||||
s2DefTwoComment: "This is a comment",
|
||||
visibility: .internal
|
||||
)
|
||||
|
||||
if extensionContent != expect {
|
||||
|
@ -13,7 +13,11 @@ import ToolCore
|
||||
|
||||
final class TagsGeneratorTests: XCTestCase {
|
||||
|
||||
private func getDefinition(name: String, lang: String, tags: [String]) -> Definition {
|
||||
private func getDefinition(
|
||||
name: String,
|
||||
lang: String,
|
||||
tags: [String]
|
||||
) -> Definition {
|
||||
let definition = Definition(name: name)
|
||||
definition.tags = tags
|
||||
definition.translations = [lang: "Some translation"]
|
||||
@ -41,11 +45,15 @@ final class TagsGeneratorTests: XCTestCase {
|
||||
]
|
||||
|
||||
// When
|
||||
let extensionContent = TagsGenerator.getExtensionContent(sections: [sectionOne, sectionTwo, sectionThree],
|
||||
lang: "ium",
|
||||
tags: ["ios", "iosonly"],
|
||||
staticVar: false,
|
||||
extensionName: "GenTags")
|
||||
let extensionContent = TagsGenerator.getExtensionContent(
|
||||
sections: [sectionOne, sectionTwo, sectionThree],
|
||||
lang: "ium",
|
||||
tags: ["ios", "iosonly"],
|
||||
staticVar: false,
|
||||
extensionName: "GenTags",
|
||||
visibility: .public
|
||||
)
|
||||
|
||||
// Expect Tags
|
||||
let expect = """
|
||||
// Generated by ResgenSwift.Strings.Tags \(ResgenSwiftVersion)
|
||||
@ -60,7 +68,7 @@ final class TagsGeneratorTests: XCTestCase {
|
||||
///
|
||||
/// Comment :
|
||||
/// No comment
|
||||
var s1_def_one: String {
|
||||
public var s1_def_one: String {
|
||||
"Some translation"
|
||||
}
|
||||
|
||||
@ -69,7 +77,7 @@ final class TagsGeneratorTests: XCTestCase {
|
||||
///
|
||||
/// Comment :
|
||||
/// No comment
|
||||
var s1_def_two: String {
|
||||
public var s1_def_two: String {
|
||||
"Some translation"
|
||||
}
|
||||
|
||||
@ -80,7 +88,7 @@ final class TagsGeneratorTests: XCTestCase {
|
||||
///
|
||||
/// Comment :
|
||||
/// No comment
|
||||
var s2_def_one: String {
|
||||
public var s2_def_one: String {
|
||||
"Some translation"
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user