Initial commit
This commit is contained in:
commit
6b9cbd4891
|
@ -0,0 +1,4 @@
|
||||||
|
.DS_Store
|
||||||
|
/.build
|
||||||
|
/Packages
|
||||||
|
/*.xcodeproj
|
|
@ -0,0 +1,16 @@
|
||||||
|
{
|
||||||
|
"object": {
|
||||||
|
"pins": [
|
||||||
|
{
|
||||||
|
"package": "SwiftPM",
|
||||||
|
"repositoryURL": "https://github.com/apple/swift-package-manager.git",
|
||||||
|
"state": {
|
||||||
|
"branch": null,
|
||||||
|
"revision": "235aacc514cb81a6881364b0fedcb3dd083228f3",
|
||||||
|
"version": "0.3.0"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"version": 1
|
||||||
|
}
|
|
@ -0,0 +1,35 @@
|
||||||
|
// swift-tools-version:5.0
|
||||||
|
|
||||||
|
import PackageDescription
|
||||||
|
|
||||||
|
let package = Package(
|
||||||
|
name: "xcode-simulator-tool",
|
||||||
|
products: [
|
||||||
|
.executable(
|
||||||
|
name: "xcode-simulator-tool",
|
||||||
|
targets: ["xcode-simulator-tool"]
|
||||||
|
)
|
||||||
|
],
|
||||||
|
dependencies: [
|
||||||
|
.package(url: "https://github.com/apple/swift-package-manager.git", from: "0.3.0")
|
||||||
|
],
|
||||||
|
targets: [
|
||||||
|
.target(
|
||||||
|
name: "xcode-simulator-tool",
|
||||||
|
dependencies: [
|
||||||
|
"XcodeSimulatorKit"
|
||||||
|
]),
|
||||||
|
.testTarget(
|
||||||
|
name: "xcode-simulator-toolTests",
|
||||||
|
dependencies: [
|
||||||
|
"xcode-simulator-tool"
|
||||||
|
]),
|
||||||
|
.target(
|
||||||
|
name: "XcodeSimulatorKit",
|
||||||
|
dependencies: [
|
||||||
|
"Utility"
|
||||||
|
]
|
||||||
|
),
|
||||||
|
|
||||||
|
]
|
||||||
|
)
|
|
@ -0,0 +1,3 @@
|
||||||
|
# xcode-simulator-tool
|
||||||
|
|
||||||
|
A description of this package.
|
|
@ -0,0 +1,2 @@
|
||||||
|
class XcodeSimulator {
|
||||||
|
}
|
|
@ -0,0 +1,14 @@
|
||||||
|
import Foundation
|
||||||
|
|
||||||
|
public class XcodeSimulatorTool {
|
||||||
|
private let arguments: [String]
|
||||||
|
|
||||||
|
public init(arguments: [String]) {
|
||||||
|
self.arguments = arguments
|
||||||
|
}
|
||||||
|
|
||||||
|
public func run() -> Int32 {
|
||||||
|
print("Hello from XcodeSimulatorTool")
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,4 @@
|
||||||
|
import Foundation
|
||||||
|
import XcodeSimulatorKit
|
||||||
|
|
||||||
|
exit(XcodeSimulatorTool(arguments: CommandLine.arguments).run())
|
|
@ -0,0 +1,7 @@
|
||||||
|
import XCTest
|
||||||
|
|
||||||
|
import xcode_simulator_toolTests
|
||||||
|
|
||||||
|
var tests = [XCTestCaseEntry]()
|
||||||
|
tests += xcode_simulator_toolTests.allTests()
|
||||||
|
XCTMain(tests)
|
|
@ -0,0 +1,9 @@
|
||||||
|
import XCTest
|
||||||
|
|
||||||
|
#if !canImport(ObjectiveC)
|
||||||
|
public func allTests() -> [XCTestCaseEntry] {
|
||||||
|
return [
|
||||||
|
testCase(xcode_simulator_toolTests.allTests),
|
||||||
|
]
|
||||||
|
}
|
||||||
|
#endif
|
|
@ -0,0 +1,47 @@
|
||||||
|
import XCTest
|
||||||
|
import class Foundation.Bundle
|
||||||
|
|
||||||
|
final class xcode_simulator_toolTests: 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("xcode-simulator-tool")
|
||||||
|
|
||||||
|
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),
|
||||||
|
]
|
||||||
|
}
|
Loading…
Reference in New Issue