Fix plist font file name and fix all tests
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:
@ -84,7 +84,7 @@ final class AnalyticsDefinitionTests: XCTestCase {
|
||||
name: "Ecran un",
|
||||
action: "",
|
||||
category: "",
|
||||
params: []
|
||||
params: [:]
|
||||
)
|
||||
}
|
||||
"""
|
||||
@ -127,7 +127,7 @@ final class AnalyticsDefinitionTests: XCTestCase {
|
||||
name: "Ecran un",
|
||||
action: "",
|
||||
category: "",
|
||||
params: []
|
||||
params: [:]
|
||||
)
|
||||
}
|
||||
"""
|
||||
|
@ -60,7 +60,7 @@ final class AnalyticsGeneratorTests: XCTestCase {
|
||||
let expect = """
|
||||
// Generated by ResgenSwift.Analytics 1.2
|
||||
|
||||
import Firebase
|
||||
import FirebaseAnalytics
|
||||
|
||||
// MARK: - Protocol
|
||||
|
||||
@ -79,7 +79,7 @@ final class AnalyticsGeneratorTests: XCTestCase {
|
||||
class FirebaseAnalyticsManager: AnalyticsManagerProtocol {
|
||||
func logScreen(name: String, path: String) {
|
||||
var parameters = [
|
||||
AnalyticsParameterScreenName: name
|
||||
AnalyticsParameterScreenName: name as NSObject
|
||||
]
|
||||
|
||||
Analytics.logEvent(
|
||||
@ -94,19 +94,25 @@ final class AnalyticsGeneratorTests: XCTestCase {
|
||||
category: String,
|
||||
params: [String: Any]?
|
||||
) {
|
||||
var parameters: [String:Any] = [
|
||||
"action": action,
|
||||
"category": category,
|
||||
var parameters: [String:NSObject] = [
|
||||
"action": action as NSObject,
|
||||
"category": category as NSObject,
|
||||
]
|
||||
|
||||
|
||||
if let supplementaryParameters = params {
|
||||
parameters.merge(supplementaryParameters) { (origin, new) -> Any in
|
||||
return origin
|
||||
for (newKey, newValue) in supplementaryParameters {
|
||||
if parameters.contains(where: { (key: String, value: NSObject) in
|
||||
key == newKey
|
||||
}) {
|
||||
continue
|
||||
}
|
||||
|
||||
parameters[newKey] = newValue as? NSObject
|
||||
}
|
||||
}
|
||||
|
||||
Analytics.logEvent(
|
||||
name,
|
||||
name.replacingOccurrences(of: [" "], with: "_"),
|
||||
parameters: parameters
|
||||
)
|
||||
}
|
||||
@ -135,7 +141,7 @@ final class AnalyticsGeneratorTests: XCTestCase {
|
||||
|
||||
private func logScreen(name: String, path: String) {
|
||||
guard isEnabled else { return }
|
||||
|
||||
|
||||
managers.forEach { manager in
|
||||
manager.logScreen(name: name, path: path)
|
||||
}
|
||||
@ -173,7 +179,7 @@ final class AnalyticsGeneratorTests: XCTestCase {
|
||||
name: "s1 def two",
|
||||
action: "",
|
||||
category: "",
|
||||
params: []
|
||||
params: [:]
|
||||
)
|
||||
}
|
||||
|
||||
@ -366,7 +372,7 @@ final class AnalyticsGeneratorTests: XCTestCase {
|
||||
name: "s1 def two",
|
||||
action: "test",
|
||||
category: "test",
|
||||
params: []
|
||||
params: [:]
|
||||
)
|
||||
}
|
||||
|
||||
@ -419,7 +425,7 @@ final class AnalyticsGeneratorTests: XCTestCase {
|
||||
// Generated by ResgenSwift.Analytics 1.2
|
||||
|
||||
import MatomoTracker
|
||||
import Firebase
|
||||
import FirebaseAnalytics
|
||||
|
||||
// MARK: - Protocol
|
||||
|
||||
@ -499,7 +505,7 @@ final class AnalyticsGeneratorTests: XCTestCase {
|
||||
class FirebaseAnalyticsManager: AnalyticsManagerProtocol {
|
||||
func logScreen(name: String, path: String) {
|
||||
var parameters = [
|
||||
AnalyticsParameterScreenName: name
|
||||
AnalyticsParameterScreenName: name as NSObject
|
||||
]
|
||||
|
||||
Analytics.logEvent(
|
||||
@ -514,19 +520,25 @@ final class AnalyticsGeneratorTests: XCTestCase {
|
||||
category: String,
|
||||
params: [String: Any]?
|
||||
) {
|
||||
var parameters: [String:Any] = [
|
||||
"action": action,
|
||||
"category": category,
|
||||
var parameters: [String:NSObject] = [
|
||||
"action": action as NSObject,
|
||||
"category": category as NSObject,
|
||||
]
|
||||
|
||||
|
||||
if let supplementaryParameters = params {
|
||||
parameters.merge(supplementaryParameters) { (origin, new) -> Any in
|
||||
return origin
|
||||
for (newKey, newValue) in supplementaryParameters {
|
||||
if parameters.contains(where: { (key: String, value: NSObject) in
|
||||
key == newKey
|
||||
}) {
|
||||
continue
|
||||
}
|
||||
|
||||
parameters[newKey] = newValue as? NSObject
|
||||
}
|
||||
}
|
||||
|
||||
Analytics.logEvent(
|
||||
name,
|
||||
name.replacingOccurrences(of: [" "], with: "_"),
|
||||
parameters: parameters
|
||||
)
|
||||
}
|
||||
@ -599,7 +611,7 @@ final class AnalyticsGeneratorTests: XCTestCase {
|
||||
name: "s1 def two",
|
||||
action: "test",
|
||||
category: "test",
|
||||
params: []
|
||||
params: [:]
|
||||
)
|
||||
}
|
||||
|
||||
|
@ -16,8 +16,8 @@ final class FontExtensionGeneratorTests: XCTestCase {
|
||||
func test_uiKit_GeneratedExtensionContent() {
|
||||
// Given
|
||||
let fontNames: [FontName] = [
|
||||
"CircularStd-Regular",
|
||||
"CircularStd-Bold"
|
||||
FontName(postscriptName: "CircularStd-Regular", filename: "CircularStd-Regular", fileExtension: "ttf"),
|
||||
FontName(postscriptName: "CircularStd-Bold", filename: "CircularStd-Bold", fileExtension: "ttf")
|
||||
]
|
||||
|
||||
// When
|
||||
@ -59,8 +59,8 @@ final class FontExtensionGeneratorTests: XCTestCase {
|
||||
func test_swiftUI_GeneratedExtensionContent() {
|
||||
// Given
|
||||
let fontNames: [FontName] = [
|
||||
"CircularStd-Regular",
|
||||
"CircularStd-Bold"
|
||||
FontName(postscriptName: "CircularStd-Regular", filename: "CircularStd-Regular", fileExtension: "ttf"),
|
||||
FontName(postscriptName: "CircularStd-Bold", filename: "CircularStd-Bold", fileExtension: "ttf")
|
||||
]
|
||||
|
||||
// When
|
||||
|
@ -14,8 +14,12 @@ final class FontNameTests: XCTestCase {
|
||||
|
||||
func test_uiKit_GeneratedProperty_noForbiddenCharacter() {
|
||||
// Given
|
||||
let fontName: FontName = "CircularStdBold"
|
||||
|
||||
let fontName = FontName(
|
||||
postscriptName: "CircularStdBold",
|
||||
filename: "CircularStd-Bold",
|
||||
fileExtension: "ttf"
|
||||
)
|
||||
|
||||
// When
|
||||
let property = fontName.getProperty(isStatic: true, isSwiftUI: false)
|
||||
|
||||
@ -31,7 +35,11 @@ final class FontNameTests: XCTestCase {
|
||||
|
||||
func test_uiKit_GeneratedProperty_withForbiddenCharacter() {
|
||||
// Given
|
||||
let fontName: FontName = "[Circular_Std+Bold-Underline]"
|
||||
let fontName = FontName(
|
||||
postscriptName: "[Circular_Std+Bold-Underline]",
|
||||
filename: "Circular_Std+Bold-Underline",
|
||||
fileExtension: "ttf"
|
||||
)
|
||||
|
||||
// When
|
||||
let property = fontName.getProperty(isStatic: true, isSwiftUI: false)
|
||||
@ -48,8 +56,12 @@ final class FontNameTests: XCTestCase {
|
||||
|
||||
func test_uiKit_GeneratedMethod_noForbiddenCharacter() {
|
||||
// Given
|
||||
let fontName: FontName = "CircularStdBold"
|
||||
|
||||
let fontName = FontName(
|
||||
postscriptName: "CircularStdBold",
|
||||
filename: "CircularStd-Bold",
|
||||
fileExtension: "ttf"
|
||||
)
|
||||
|
||||
// When
|
||||
let property = fontName.getProperty(isStatic: false, isSwiftUI: false)
|
||||
|
||||
@ -65,8 +77,12 @@ final class FontNameTests: XCTestCase {
|
||||
|
||||
func test_uiKit_GeneratedMethod_withForbiddenCharacter() {
|
||||
// Given
|
||||
let fontName: FontName = "[Circular_Std+Bold-Underline]"
|
||||
|
||||
let fontName = FontName(
|
||||
postscriptName: "[Circular_Std+Bold-Underline]",
|
||||
filename: "Circular_Std+Bold-Underline",
|
||||
fileExtension: "ttf"
|
||||
)
|
||||
|
||||
// When
|
||||
let property = fontName.getProperty(isStatic: false, isSwiftUI: false)
|
||||
|
||||
@ -82,8 +98,12 @@ final class FontNameTests: XCTestCase {
|
||||
|
||||
func test_swiftUI_GeneratedProperty_noForbiddenCharacter() {
|
||||
// Given
|
||||
let fontName: FontName = "CircularStdBold"
|
||||
|
||||
let fontName = FontName(
|
||||
postscriptName: "CircularStdBold",
|
||||
filename: "CircularStd-Bold",
|
||||
fileExtension: "ttf"
|
||||
)
|
||||
|
||||
// When
|
||||
let property = fontName.getProperty(isStatic: true, isSwiftUI: true)
|
||||
|
||||
@ -99,8 +119,12 @@ final class FontNameTests: XCTestCase {
|
||||
|
||||
func test_swiftUI_GeneratedProperty_withForbiddenCharacter() {
|
||||
// Given
|
||||
let fontName: FontName = "[Circular_Std+Bold-Underline]"
|
||||
|
||||
let fontName = FontName(
|
||||
postscriptName: "[Circular_Std+Bold-Underline]",
|
||||
filename: "Circular_Std+Bold-Underline",
|
||||
fileExtension: "ttf"
|
||||
)
|
||||
|
||||
// When
|
||||
let property = fontName.getProperty(isStatic: true, isSwiftUI: true)
|
||||
|
||||
@ -116,8 +140,12 @@ final class FontNameTests: XCTestCase {
|
||||
|
||||
func test_swiftUI_GeneratedMethod_noForbiddenCharacter() {
|
||||
// Given
|
||||
let fontName: FontName = "CircularStdBold"
|
||||
|
||||
let fontName = FontName(
|
||||
postscriptName: "CircularStdBold",
|
||||
filename: "CircularStd-Bold",
|
||||
fileExtension: "ttf"
|
||||
)
|
||||
|
||||
// When
|
||||
let property = fontName.getProperty(isStatic: false, isSwiftUI: true)
|
||||
|
||||
@ -133,8 +161,12 @@ final class FontNameTests: XCTestCase {
|
||||
|
||||
func test_swiftUI_GeneratedMethod_withForbiddenCharacter() {
|
||||
// Given
|
||||
let fontName: FontName = "[Circular_Std+Bold-Underline]"
|
||||
|
||||
let fontName = FontName(
|
||||
postscriptName: "[Circular_Std+Bold-Underline]",
|
||||
filename: "Circular_Std+Bold-Underline",
|
||||
fileExtension: "ttf"
|
||||
)
|
||||
|
||||
// When
|
||||
let property = fontName.getProperty(isStatic: false, isSwiftUI: true)
|
||||
|
||||
|
@ -14,8 +14,8 @@ final class FontPlistGeneratorTests: XCTestCase {
|
||||
func testGeneratedPlist() {
|
||||
// Given
|
||||
let fontNames: [FontName] = [
|
||||
"CircularStd-Regular",
|
||||
"CircularStd-Bold"
|
||||
FontName(postscriptName: "CircularStd-Regular", filename: "CircularStd-Regular", fileExtension: "ttf"),
|
||||
FontName(postscriptName: "CircularStd-Bold", filename: "CircularStd-Bold", fileExtension: "ttf")
|
||||
]
|
||||
|
||||
// When
|
||||
@ -25,8 +25,8 @@ final class FontPlistGeneratorTests: XCTestCase {
|
||||
let expect = """
|
||||
<key>UIAppFonts</key>
|
||||
<array>
|
||||
<string>CircularStd-Regular</string>
|
||||
<string>CircularStd-Bold</string>
|
||||
<string>CircularStd-Regular.ttf</string>
|
||||
<string>CircularStd-Bold.ttf</string>
|
||||
</array>
|
||||
"""
|
||||
|
||||
|
@ -57,12 +57,18 @@ final class TagsGeneratorTests: XCTestCase {
|
||||
|
||||
/// Translation in ium :
|
||||
/// Some translation
|
||||
///
|
||||
/// Comment :
|
||||
/// No comment
|
||||
var s1_def_one: String {
|
||||
"Some translation"
|
||||
}
|
||||
|
||||
/// Translation in ium :
|
||||
/// Some translation
|
||||
///
|
||||
/// Comment :
|
||||
/// No comment
|
||||
var s1_def_two: String {
|
||||
"Some translation"
|
||||
}
|
||||
@ -71,6 +77,9 @@ final class TagsGeneratorTests: XCTestCase {
|
||||
|
||||
/// Translation in ium :
|
||||
/// Some translation
|
||||
///
|
||||
/// Comment :
|
||||
/// No comment
|
||||
var s2_def_one: String {
|
||||
"Some translation"
|
||||
}
|
||||
|
Reference in New Issue
Block a user