Defined the library and tests targets in the Package file.

This commit is contained in:
Javier Cicchelli 2024-09-07 09:04:13 +02:00
parent d3abf7559d
commit 37512df49e
3 changed files with 24 additions and 10 deletions

View File

@ -3,21 +3,34 @@
import PackageDescription import PackageDescription
let package = Package( let package = Package(
name: "amiibo-api", name: AmiiboAPI.package,
products: [ products: [
// Products define the executables and libraries a package produces, making them visible to other packages.
.library( .library(
name: "amiibo-api", name: AmiiboAPI.package,
targets: ["amiibo-api"]), targets: [
AmiiboAPI.target
]
)
], ],
targets: [ targets: [
// Targets are the basic building blocks of a package, defining a module or a test suite.
// Targets can depend on other targets in this package and products from dependencies.
.target( .target(
name: "amiibo-api"), name: AmiiboAPI.target,
path: "Sources"
),
.testTarget( .testTarget(
name: "amiibo-apiTests", name: AmiiboAPI.test,
dependencies: ["amiibo-api"] dependencies: [
.byName(name: AmiiboAPI.target)
],
path: "Tests"
), ),
] ]
) )
// MARK: - Constants
enum AmiiboAPI {
static let package = "amiibo-api"
static let target = "AmiiboAPI"
static let test = "\(AmiiboAPI.target)Tests"
}

View File

@ -1,5 +1,6 @@
import Testing import Testing
@testable import amiibo_api
@testable import AmiiboAPI
@Test func example() async throws { @Test func example() async throws {
// Write your test here and use APIs like `#expect(...)` to check expected conditions. // Write your test here and use APIs like `#expect(...)` to check expected conditions.