From 270dd8e36290ea16df77f26306d685126115092b Mon Sep 17 00:00:00 2001 From: Piv <18462828+Piv200@users.noreply.github.com> Date: Thu, 7 May 2020 20:54:26 +0930 Subject: [PATCH] initial Swifty Car commit --- SwiftyCar/Package.swift | 28 +++++++++++++++++++ SwiftyCar/Sources/SwiftyCar/SwiftyCar.swift | 3 ++ SwiftyCar/Tests/LinuxMain.swift | 7 +++++ .../Tests/SwiftyCarTests/SwiftyCarTests.swift | 15 ++++++++++ .../SwiftyCarTests/XCTestManifests.swift | 9 ++++++ 5 files changed, 62 insertions(+) create mode 100644 SwiftyCar/Package.swift create mode 100644 SwiftyCar/Sources/SwiftyCar/SwiftyCar.swift create mode 100644 SwiftyCar/Tests/LinuxMain.swift create mode 100644 SwiftyCar/Tests/SwiftyCarTests/SwiftyCarTests.swift create mode 100644 SwiftyCar/Tests/SwiftyCarTests/XCTestManifests.swift diff --git a/SwiftyCar/Package.swift b/SwiftyCar/Package.swift new file mode 100644 index 0000000..5a6fb5e --- /dev/null +++ b/SwiftyCar/Package.swift @@ -0,0 +1,28 @@ +// swift-tools-version:5.2 +// The swift-tools-version declares the minimum version of Swift required to build this package. + +import PackageDescription + +let package = Package( + name: "SwiftyCar", + products: [ + // Products define the executables and libraries produced by a package, and make them visible to other packages. + .library( + name: "SwiftyCar", + targets: ["SwiftyCar"]), + ], + dependencies: [ + // Dependencies declare other packages that this package depends on. + // .package(url: /* package url */, from: "1.0.0"), + ], + targets: [ + // Targets are the basic building blocks of a package. A target can define a module or a test suite. + // Targets can depend on other targets in this package, and on products in packages which this package depends on. + .target( + name: "SwiftyCar", + dependencies: []), + .testTarget( + name: "SwiftyCarTests", + dependencies: ["SwiftyCar"]), + ] +) diff --git a/SwiftyCar/Sources/SwiftyCar/SwiftyCar.swift b/SwiftyCar/Sources/SwiftyCar/SwiftyCar.swift new file mode 100644 index 0000000..d091fe7 --- /dev/null +++ b/SwiftyCar/Sources/SwiftyCar/SwiftyCar.swift @@ -0,0 +1,3 @@ +struct SwiftyCar { + var text = "Hello, World!" +} diff --git a/SwiftyCar/Tests/LinuxMain.swift b/SwiftyCar/Tests/LinuxMain.swift new file mode 100644 index 0000000..c68226f --- /dev/null +++ b/SwiftyCar/Tests/LinuxMain.swift @@ -0,0 +1,7 @@ +import XCTest + +import SwiftyCarTests + +var tests = [XCTestCaseEntry]() +tests += SwiftyCarTests.allTests() +XCTMain(tests) diff --git a/SwiftyCar/Tests/SwiftyCarTests/SwiftyCarTests.swift b/SwiftyCar/Tests/SwiftyCarTests/SwiftyCarTests.swift new file mode 100644 index 0000000..2d727ae --- /dev/null +++ b/SwiftyCar/Tests/SwiftyCarTests/SwiftyCarTests.swift @@ -0,0 +1,15 @@ +import XCTest +@testable import SwiftyCar + +final class SwiftyCarTests: XCTestCase { + func testExample() { + // This is an example of a functional test case. + // Use XCTAssert and related functions to verify your tests produce the correct + // results. + XCTAssertEqual(SwiftyCar().text, "Hello, World!") + } + + static var allTests = [ + ("testExample", testExample), + ] +} diff --git a/SwiftyCar/Tests/SwiftyCarTests/XCTestManifests.swift b/SwiftyCar/Tests/SwiftyCarTests/XCTestManifests.swift new file mode 100644 index 0000000..02cc67f --- /dev/null +++ b/SwiftyCar/Tests/SwiftyCarTests/XCTestManifests.swift @@ -0,0 +1,9 @@ +import XCTest + +#if !canImport(ObjectiveC) +public func allTests() -> [XCTestCaseEntry] { + return [ + testCase(SwiftyCarTests.allTests), + ] +} +#endif