Migrate tests from XCTest to Swift Testing
- 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:
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)
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user