1212// See the License for the specific language governing permissions and
1313// limitations under the License.
1414
15+ import Foundation
16+
1517@testable import App
1618
17- import XCTest
19+ import Testing
1820
1921
20- class ManifestTests : XCTestCase {
22+ @ Suite struct ManifestTests {
2123
22- func test_decode_Product_Type ( ) throws {
24+ @ Test func decode_Product_Type ( ) throws {
2325 // Test product type decoding.
2426 // JSON snippets via `swift package dump-package` from the following
2527 // Package.swift `products` definition:
@@ -45,8 +47,7 @@ class ManifestTests: XCTestCase {
4547 }
4648 }
4749 """ . utf8)
48- XCTAssertEqual ( try JSONDecoder ( ) . decode ( Test . self, from: data) ,
49- . init( type: . executable) )
50+ #expect( try JSONDecoder ( ) . decode ( Test . self, from: data) == . init( type: . executable) )
5051 }
5152 do { // lib - automatic
5253 let data = Data ( """
@@ -56,8 +57,7 @@ class ManifestTests: XCTestCase {
5657 }
5758 }
5859 """ . utf8)
59- XCTAssertEqual ( try JSONDecoder ( ) . decode ( Test . self, from: data) ,
60- . init( type: . library( . automatic) ) )
60+ #expect( try JSONDecoder ( ) . decode ( Test . self, from: data) == . init( type: . library( . automatic) ) )
6161 }
6262 do { // lib - dynamic
6363 let data = Data ( """
@@ -67,8 +67,7 @@ class ManifestTests: XCTestCase {
6767 }
6868 }
6969 """ . utf8)
70- XCTAssertEqual ( try JSONDecoder ( ) . decode ( Test . self, from: data) ,
71- . init( type: . library( . dynamic) ) )
70+ #expect( try JSONDecoder ( ) . decode ( Test . self, from: data) == . init( type: . library( . dynamic) ) )
7271 }
7372 do { // lib - static
7473 let data = Data ( """
@@ -78,8 +77,7 @@ class ManifestTests: XCTestCase {
7877 }
7978 }
8079 """ . utf8)
81- XCTAssertEqual ( try JSONDecoder ( ) . decode ( Test . self, from: data) ,
82- . init( type: . library( . static) ) )
80+ #expect( try JSONDecoder ( ) . decode ( Test . self, from: data) == . init( type: . library( . static) ) )
8381 }
8482 do { // test
8583 let data = Data ( """
@@ -89,30 +87,29 @@ class ManifestTests: XCTestCase {
8987 }
9088 }
9189 """ . utf8)
92- XCTAssertEqual ( try JSONDecoder ( ) . decode ( Test . self, from: data) ,
93- . init( type: . test) )
90+ #expect( try JSONDecoder ( ) . decode ( Test . self, from: data) == . init( type: . test) )
9491 }
9592 }
9693
97- func test_decode_basic ( ) throws {
94+ @ Test func decode_basic ( ) throws {
9895 let data = try fixtureData ( for: " manifest-1.json " )
9996 let m = try JSONDecoder ( ) . decode ( Manifest . self, from: data)
100- XCTAssertEqual ( m. name, " SPI-Server " )
101- XCTAssertEqual ( m. platforms, [ . init( platformName: . macos, version: " 10.15 " ) ] )
102- XCTAssertEqual ( m. products, [ . init( name: " Some Product " ,
97+ #expect ( m. name == " SPI-Server " )
98+ #expect ( m. platforms == [ . init( platformName: . macos, version: " 10.15 " ) ] )
99+ #expect ( m. products == [ . init( name: " Some Product " ,
103100 targets: [ " t1 " , " t2 " ] ,
104101 type: . library( . automatic) ) ] )
105- XCTAssertEqual ( m. swiftLanguageVersions, [ " 4 " , " 4.2 " , " 5 " ] )
106- XCTAssertEqual ( m. targets, [ . init( name: " App " , type: . regular) ,
102+ #expect ( m. swiftLanguageVersions == [ " 4 " , " 4.2 " , " 5 " ] )
103+ #expect ( m. targets == [ . init( name: " App " , type: . regular) ,
107104 . init( name: " Run " , type: . regular) ,
108105 . init( name: " AppTests " , type: . test) ] )
109- XCTAssertEqual ( m. toolsVersion, . init( version: " 5.2.0 " ) )
106+ #expect ( m. toolsVersion == . init( version: " 5.2.0 " ) )
110107 }
111108
112- func test_decode_products_complex ( ) throws {
109+ @ Test func decode_products_complex ( ) throws {
113110 let data = try fixtureData ( for: " SwiftNIO.json " )
114111 let m = try JSONDecoder ( ) . decode ( Manifest . self, from: data)
115- XCTAssertEqual ( m. products, [
112+ #expect ( m. products == [
116113 . init( name: " NIOEchoServer " ,
117114 targets: [ " NIOEchoServer " ] ,
118115 type: . executable) ,
@@ -176,28 +173,27 @@ class ManifestTests: XCTestCase {
176173 ] )
177174 }
178175
179- func test_platform_list ( ) throws {
176+ @ Test func platform_list ( ) throws {
180177 // Test to ensure the platforms listed in the DTO struct Manifest.Platform.Name
181178 // do not accidentally diverge from those in the db entity's Platform.Name
182- XCTAssertEqual ( Manifest . Platform. Name. allCases. map ( \. rawValue) . sorted ( ) ,
183- Platform . Name. allCases. map ( \. rawValue) . sorted ( ) )
179+ #expect( Manifest . Platform. Name. allCases. map ( \. rawValue) . sorted ( ) == Platform . Name. allCases. map ( \. rawValue) . sorted ( ) )
184180 }
185181
186- func test_decode_plugin_products ( ) throws {
182+ @ Test func decode_plugin_products ( ) throws {
187183 let data = try fixtureData ( for: " manifest-plugin.json " )
188184 let m = try JSONDecoder ( ) . decode ( Manifest . self, from: data)
189- XCTAssertEqual ( m. products, [
185+ #expect ( m. products == [
190186 . init( name: " Swift-DocC " , targets: [ " Swift-DocC " ] , type: . plugin) ,
191187 . init( name: " Swift-DocC Preview " , targets: [ " Swift-DocC Preview " ] , type: . plugin) ,
192188 ] )
193189 }
194190
195- func test_issue_2875 ( ) throws {
191+ @ Test func issue_2875 ( ) throws {
196192 // Support decoding custom platform with different capitalisation
197193 // https://github.com/SwiftPackageIndex/SwiftPackageIndex-Server/issues/2875
198194 let data = try fixtureData ( for: " Lottie-ios.json " )
199195 let m = try JSONDecoder ( ) . decode ( Manifest . self, from: data)
200- XCTAssertEqual ( m. platforms, [
196+ #expect ( m. platforms == [
201197 . init( platformName: . ios, version: " 11.0 " ) ,
202198 . init( platformName: . macos, version: " 10.11 " ) ,
203199 . init( platformName: . tvos, version: " 11.0 " ) ,
0 commit comments