diff --git a/.DS_Store b/.DS_Store index 0cb9b08..6c877d4 100644 Binary files a/.DS_Store and b/.DS_Store differ diff --git a/.swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata b/.swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata new file mode 100644 index 0000000..919434a --- /dev/null +++ b/.swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,7 @@ + + + + + diff --git a/Package.swift b/Package.swift new file mode 100644 index 0000000..3300d1d --- /dev/null +++ b/Package.swift @@ -0,0 +1,22 @@ +// swift-tools-version:5.1 +// The swift-tools-version declares the minimum version of Swift required to build this package. + +import PackageDescription + +let package = Package( + name: "BKCountDownTimer", + 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: "BKCountDownTimer", + dependencies: []), + .testTarget( + name: "BKCountDownTimerTests", + dependencies: ["BKCountDownTimer"]), + ] +) diff --git a/Sources/CircleBase.swift b/Sources/BKCountDownTimer/CircleBase.swift similarity index 100% rename from Sources/CircleBase.swift rename to Sources/BKCountDownTimer/CircleBase.swift diff --git a/Sources/CircleCount.swift b/Sources/BKCountDownTimer/CircleCount.swift similarity index 100% rename from Sources/CircleCount.swift rename to Sources/BKCountDownTimer/CircleCount.swift diff --git a/Sources/CircleTic.swift b/Sources/BKCountDownTimer/CircleTic.swift similarity index 100% rename from Sources/CircleTic.swift rename to Sources/BKCountDownTimer/CircleTic.swift diff --git a/Sources/CircleTimer.swift b/Sources/BKCountDownTimer/CircleTimer.swift similarity index 100% rename from Sources/CircleTimer.swift rename to Sources/BKCountDownTimer/CircleTimer.swift diff --git a/Tests/BKCountDownTimerTests/BKCountDownTimerTests.swift b/Tests/BKCountDownTimerTests/BKCountDownTimerTests.swift new file mode 100644 index 0000000..2145d75 --- /dev/null +++ b/Tests/BKCountDownTimerTests/BKCountDownTimerTests.swift @@ -0,0 +1,47 @@ +import XCTest +import class Foundation.Bundle + +final class BKCountDownTimerTests: XCTestCase { + func testExample() throws { + // This is an example of a functional test case. + // Use XCTAssert and related functions to verify your tests produce the correct + // results. + + // Some of the APIs that we use below are available in macOS 10.13 and above. + guard #available(macOS 10.13, *) else { + return + } + + let fooBinary = productsDirectory.appendingPathComponent("BKCountDownTimer") + + let process = Process() + process.executableURL = fooBinary + + let pipe = Pipe() + process.standardOutput = pipe + + try process.run() + process.waitUntilExit() + + let data = pipe.fileHandleForReading.readDataToEndOfFile() + let output = String(data: data, encoding: .utf8) + + XCTAssertEqual(output, "Hello, world!\n") + } + + /// Returns path to the built products directory. + var productsDirectory: URL { + #if os(macOS) + for bundle in Bundle.allBundles where bundle.bundlePath.hasSuffix(".xctest") { + return bundle.bundleURL.deletingLastPathComponent() + } + fatalError("couldn't find the products directory") + #else + return Bundle.main.bundleURL + #endif + } + + static var allTests = [ + ("testExample", testExample), + ] +} diff --git a/Tests/BKCountDownTimerTests/XCTestManifests.swift b/Tests/BKCountDownTimerTests/XCTestManifests.swift new file mode 100644 index 0000000..ea60859 --- /dev/null +++ b/Tests/BKCountDownTimerTests/XCTestManifests.swift @@ -0,0 +1,9 @@ +import XCTest + +#if !canImport(ObjectiveC) +public func allTests() -> [XCTestCaseEntry] { + return [ + testCase(BKCountDownTimerTests.allTests), + ] +} +#endif diff --git a/Tests/LinuxMain.swift b/Tests/LinuxMain.swift new file mode 100644 index 0000000..162f210 --- /dev/null +++ b/Tests/LinuxMain.swift @@ -0,0 +1,7 @@ +import XCTest + +import BKCountDownTimerTests + +var tests = [XCTestCaseEntry]() +tests += BKCountDownTimerTests.allTests() +XCTMain(tests)