Migrate tests from XCTest to Swift Testing
openium/resgen.swift/pipeline/head There was a failure building this commit
openium/resgen.swift/pipeline/pr-master There was a failure building this commit

- Convert XCTestCase classes to structs with @Test functions
- Replace XCTAssert* with #expect, and force unwraps/XCTFail with #require
- Resolve test bundle via a class token in the CLI smoke test (Swift Testing
  does not register the .xctest bundle in Bundle.allBundles)
- Rename adaptForXCTest() to adaptForTest()
This commit is contained in:
t.schmitt committed 2026-11-23 15:53:21 +01:00
1 parent fdd23f4378
commit ac5d9cef58
24 files changed
+437 -374

No files matched your search

@@ -7,13 +7,14 @@
import Foundation
@testable import ResgenSwift
import XCTest
import Testing
final class AnalyticsConfigurationTests: XCTestCase {
struct AnalyticsConfigurationTests {
let projectDirectory = "projectDirectory/"
func test_argsGeneration_requiredArgs() {
@Test
func argsGeneration_requiredArgs() {
// Given
let testingConfiguration = AnalyticsConfiguration(
inputFile: "path/to/tags.yml",
@@ -39,10 +40,11 @@ final class AnalyticsConfigurationTests: XCTestCase {
"projectDirectory/Analytics/Generated/AnalyticsManager.swift",
]
XCTAssertEqual(arguments, expectedArguments)
#expect(arguments == expectedArguments)
}
func test_argsGeneration_allArguments() {
@Test
func argsGeneration_allArguments() {
// Given
let testingConfiguration = AnalyticsConfiguration(
inputFile: "path/to/tags.yml",
@@ -75,6 +77,6 @@ final class AnalyticsConfigurationTests: XCTestCase {
"mySuffix"
]
XCTAssertEqual(arguments, expectedArguments)
#expect(arguments == expectedArguments)
}
}