From f3f715303c0c74fbb1d763600cafd149e16e4bca Mon Sep 17 00:00:00 2001 From: Rachel Brindle Date: Sun, 8 Sep 2024 22:28:50 -0700 Subject: [PATCH] Support the current version of Swift Testing --- Nimble.xcodeproj/project.pbxproj | 17 ----- .../xcshareddata/swiftpm/Package.resolved | 21 +----- Package@swift-6.0.swift | 68 ------------------- .../Adapters/NimbleSwiftTestingHandler.swift | 15 +--- .../NimbleTests/SwiftTestingSupportTest.swift | 2 +- 5 files changed, 5 insertions(+), 118 deletions(-) delete mode 100644 Package@swift-6.0.swift diff --git a/Nimble.xcodeproj/project.pbxproj b/Nimble.xcodeproj/project.pbxproj index 0305403e0..90edd5607 100644 --- a/Nimble.xcodeproj/project.pbxproj +++ b/Nimble.xcodeproj/project.pbxproj @@ -134,7 +134,6 @@ 8922828F2B283956002DA355 /* AsyncAwaitTest+Require.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8922828E2B283956002DA355 /* AsyncAwaitTest+Require.swift */; }; 8923E60D2B47CE7E00F3961A /* Map.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8923E60C2B47CE7E00F3961A /* Map.swift */; }; 8923E6102B47D08300F3961A /* MapTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8923E60E2B47D06E00F3961A /* MapTest.swift */; }; - 8924FE0B2C1CA6BB00A9062A /* Testing in Frameworks */ = {isa = PBXBuildFile; productRef = 8924FE0A2C1CA6BB00A9062A /* Testing */; }; 892FDF1329D3EA7700523A80 /* AsyncExpression.swift in Sources */ = {isa = PBXBuildFile; fileRef = 892FDF1229D3EA7700523A80 /* AsyncExpression.swift */; }; 895644DD2C1B63910006EC12 /* NimbleSwiftTestingHandler.swift in Sources */ = {isa = PBXBuildFile; fileRef = 895644DC2C1B63910006EC12 /* NimbleSwiftTestingHandler.swift */; }; 895644DF2C1B71DE0006EC12 /* SwiftTestingSupportTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 895644DE2C1B71DE0006EC12 /* SwiftTestingSupportTest.swift */; }; @@ -379,7 +378,6 @@ buildActionMask = 2147483647; files = ( 89D8AC872B3211EA00410644 /* CwlPosixPreconditionTesting in Frameworks */, - 8924FE0B2C1CA6BB00A9062A /* Testing in Frameworks */, 89D8AC852B3211C600410644 /* CwlCatchException in Frameworks */, 89D8AC892B3211EA00410644 /* CwlPreconditionTesting in Frameworks */, ); @@ -735,7 +733,6 @@ 89D8AC842B3211C600410644 /* CwlCatchException */, 89D8AC862B3211EA00410644 /* CwlPosixPreconditionTesting */, 89D8AC882B3211EA00410644 /* CwlPreconditionTesting */, - 8924FE0A2C1CA6BB00A9062A /* Testing */, ); productName = "Nimble-macOS"; productReference = 1F925EAD195C0D6300ED456B /* Nimble.framework */; @@ -797,7 +794,6 @@ packageReferences = ( 89D8AC812B32119300410644 /* XCRemoteSwiftPackageReference "CwlCatchException" */, 89D8AC822B3211A900410644 /* XCRemoteSwiftPackageReference "CwlPreconditionTesting" */, - 8924FE092C1CA6BB00A9062A /* XCRemoteSwiftPackageReference "swift-testing" */, ); productRefGroup = 1F1A742A1940169200FFFC47 /* Products */; projectDirPath = ""; @@ -1370,14 +1366,6 @@ /* End XCConfigurationList section */ /* Begin XCRemoteSwiftPackageReference section */ - 8924FE092C1CA6BB00A9062A /* XCRemoteSwiftPackageReference "swift-testing" */ = { - isa = XCRemoteSwiftPackageReference; - repositoryURL = "https://github.com/younata/swift-testing"; - requirement = { - branch = "public-issues-pitch"; - kind = branch; - }; - }; 89D8AC812B32119300410644 /* XCRemoteSwiftPackageReference "CwlCatchException" */ = { isa = XCRemoteSwiftPackageReference; repositoryURL = "https://github.com/mattgallagher/CwlCatchException"; @@ -1397,11 +1385,6 @@ /* End XCRemoteSwiftPackageReference section */ /* Begin XCSwiftPackageProductDependency section */ - 8924FE0A2C1CA6BB00A9062A /* Testing */ = { - isa = XCSwiftPackageProductDependency; - package = 8924FE092C1CA6BB00A9062A /* XCRemoteSwiftPackageReference "swift-testing" */; - productName = Testing; - }; 89D8AC842B3211C600410644 /* CwlCatchException */ = { isa = XCSwiftPackageProductDependency; package = 89D8AC812B32119300410644 /* XCRemoteSwiftPackageReference "CwlCatchException" */; diff --git a/Nimble.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved b/Nimble.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved index d1bcdbdf2..bf75cf0a2 100644 --- a/Nimble.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved +++ b/Nimble.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved @@ -1,5 +1,4 @@ { - "originHash" : "f14c33ce48473aca15a7346134d7546c72ed4d7b9e9e62243a4682949138cbe2", "pins" : [ { "identity" : "cwlcatchexception", @@ -18,25 +17,7 @@ "revision" : "dc9af4781f2afdd1e68e90f80b8603be73ea7abc", "version" : "2.2.0" } - }, - { - "identity" : "swift-syntax", - "kind" : "remoteSourceControl", - "location" : "https://github.com/apple/swift-syntax.git", - "state" : { - "revision" : "4c6cc0a3b9e8f14b3ae2307c5ccae4de6167ac2c", - "version" : "600.0.0-prerelease-2024-06-12" - } - }, - { - "identity" : "swift-testing", - "kind" : "remoteSourceControl", - "location" : "https://github.com/younata/swift-testing", - "state" : { - "branch" : "public-issues-pitch", - "revision" : "e945bad553d3c0b66ca489e2d52ad26119ce818d" - } } ], - "version" : 3 + "version" : 2 } diff --git a/Package@swift-6.0.swift b/Package@swift-6.0.swift deleted file mode 100644 index e54ec4c6f..000000000 --- a/Package@swift-6.0.swift +++ /dev/null @@ -1,68 +0,0 @@ -// swift-tools-version:6.0 -import PackageDescription - -let package = Package( - name: "Nimble", - platforms: [ - .macOS(.v10_15), .iOS(.v13), .tvOS(.v13), .watchOS(.v6), .visionOS(.v1) - ], - products: [ - .library( - name: "Nimble", - targets: { - var targets: [String] = ["Nimble"] - #if os(macOS) - targets.append("NimbleObjectiveC") - #endif - return targets - }() - ), - ], - dependencies: [ - .package(url: "https://github.com/mattgallagher/CwlPreconditionTesting.git", .upToNextMajor(from: "2.2.0")), - .package(url: "https://github.com/apple/swift-docc-plugin", from: "1.0.0"), - .package(url: "https://github.com/younata/swift-testing", branch: "public-issues-pitch") - ], - targets: { - var testHelperDependencies: [PackageDescription.Target.Dependency] = ["Nimble"] - #if os(macOS) - testHelperDependencies.append("NimbleObjectiveC") - #endif - var targets: [Target] = [ - .target( - name: "Nimble", - dependencies: [ - .product(name: "CwlPreconditionTesting", package: "CwlPreconditionTesting", - condition: .when(platforms: [.macOS, .iOS, .macCatalyst, .visionOS])), - .product(name: "CwlPosixPreconditionTesting", package: "CwlPreconditionTesting", - condition: .when(platforms: [.tvOS, .watchOS])), - .product(name: "Testing", package: "swift-testing") - ], - exclude: ["Info.plist"] - ), - .target( - name: "NimbleSharedTestHelpers", - dependencies: testHelperDependencies - ), - .testTarget( - name: "NimbleTests", - dependencies: ["Nimble", "NimbleSharedTestHelpers"], - exclude: ["Info.plist"] - ), - ] -#if os(macOS) - targets.append(contentsOf: [ - .target( - name: "NimbleObjectiveC", - dependencies: ["Nimble"] - ), - .testTarget( - name: "NimbleObjectiveCTests", - dependencies: ["NimbleObjectiveC", "Nimble", "NimbleSharedTestHelpers"] - ) - ]) - #endif - return targets - }(), - swiftLanguageVersions: [.v5] -) diff --git a/Sources/Nimble/Adapters/NimbleSwiftTestingHandler.swift b/Sources/Nimble/Adapters/NimbleSwiftTestingHandler.swift index a37811e87..ebd2aa11c 100644 --- a/Sources/Nimble/Adapters/NimbleSwiftTestingHandler.swift +++ b/Sources/Nimble/Adapters/NimbleSwiftTestingHandler.swift @@ -36,18 +36,9 @@ public func recordTestingFailure(_ message: String, location: SourceLocation) { column: Int(location.column) ) - let issue = Testing.Issue( - kind: .expectationFailed( - Testing.Expectation( - mismatchedErrorDescription: message, - differenceDescription: nil, - isPassing: false, - isRequired: false, - sourceLocation: testingLocation - ) - ), - sourceContext: SourceContext(sourceLocation: testingLocation) + Testing.Issue.record( + "\(message)", + sourceLocation: testingLocation ) - issue.record() #endif } diff --git a/Tests/NimbleTests/SwiftTestingSupportTest.swift b/Tests/NimbleTests/SwiftTestingSupportTest.swift index 39e5b917e..d54a9346a 100644 --- a/Tests/NimbleTests/SwiftTestingSupportTest.swift +++ b/Tests/NimbleTests/SwiftTestingSupportTest.swift @@ -6,7 +6,7 @@ import XCTest @Suite struct SwiftTestingSupportSuite { @Test func reportsAssertionFailuresToSwiftTesting() { withKnownIssue { - fail() + expect(1).to(equal(2)) } }