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:
@ -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)
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user