Add empty package with basic dependencies
This commit is contained in:
parent
3bd8168a65
commit
e62d8aeda9
|
@ -0,0 +1,17 @@
|
|||
# See https://pre-commit.com for more information
|
||||
# See https://pre-commit.com/hooks.html for more hooks
|
||||
repos:
|
||||
- repo: https://github.com/pre-commit/pre-commit-hooks
|
||||
rev: v2.5.0
|
||||
hooks:
|
||||
- id: trailing-whitespace
|
||||
- id: end-of-file-fixer
|
||||
- id: check-yaml
|
||||
- id: check-added-large-files
|
||||
- id: detect-private-key
|
||||
- id: check-merge-conflict
|
||||
- repo: https://github.com/hodovani/pre-commit-swift
|
||||
rev: master
|
||||
hooks:
|
||||
- id: swift-lint
|
||||
- id: swift-format
|
|
@ -0,0 +1,10 @@
|
|||
--indent 2
|
||||
--indentcase false
|
||||
--trimwhitespace always
|
||||
--nospaceoperators
|
||||
--empty tuple
|
||||
--operatorfunc nospace
|
||||
--ifdef noindent
|
||||
--stripunusedargs closure-only
|
||||
--disable andOperator
|
||||
--swiftversion 5.2
|
|
@ -0,0 +1,15 @@
|
|||
disabled_rules:
|
||||
- trailing_comma
|
||||
- identifier_name
|
||||
- void_return
|
||||
- operator_whitespace
|
||||
- nesting
|
||||
- cyclomatic_complexity
|
||||
|
||||
line_length: 100
|
||||
|
||||
function_body_length: 50
|
||||
|
||||
included:
|
||||
- Sources
|
||||
- Tests
|
|
@ -0,0 +1,5 @@
|
|||
{
|
||||
"editor.tabSize": 2,
|
||||
"editor.formatOnSave": true,
|
||||
"editor.formatOnType": true
|
||||
}
|
|
@ -0,0 +1,34 @@
|
|||
{
|
||||
"object": {
|
||||
"pins": [
|
||||
{
|
||||
"package": "SKQueue",
|
||||
"repositoryURL": "https://github.com/daniel-pedersen/SKQueue.git",
|
||||
"state": {
|
||||
"branch": null,
|
||||
"revision": "a52c15ea2a8f28fde607155cf75c1abe9ea000a7",
|
||||
"version": "1.2.0"
|
||||
}
|
||||
},
|
||||
{
|
||||
"package": "swift-argument-parser",
|
||||
"repositoryURL": "https://github.com/apple/swift-argument-parser",
|
||||
"state": {
|
||||
"branch": null,
|
||||
"revision": "9f04d1ff1afbccd02279338a2c91e5f27c45e93a",
|
||||
"version": "0.0.5"
|
||||
}
|
||||
},
|
||||
{
|
||||
"package": "swift-nio",
|
||||
"repositoryURL": "https://github.com/apple/swift-nio.git",
|
||||
"state": {
|
||||
"branch": null,
|
||||
"revision": "e876fb37410e0036b98b5361bb18e6854739572b",
|
||||
"version": "2.16.0"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"version": 1
|
||||
}
|
|
@ -0,0 +1,25 @@
|
|||
// 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: "carton",
|
||||
dependencies: [
|
||||
.package(url: "https://github.com/apple/swift-argument-parser", .upToNextMinor(from: "0.0.5")),
|
||||
.package(url: "https://github.com/apple/swift-nio.git", from: "2.16.0"),
|
||||
.package(url: "https://github.com/daniel-pedersen/SKQueue.git", from: "1.2.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: "carton",
|
||||
dependencies: []
|
||||
),
|
||||
.testTarget(
|
||||
name: "CartonTests",
|
||||
dependencies: ["carton"]
|
||||
),
|
||||
]
|
||||
)
|
|
@ -0,0 +1 @@
|
|||
print("Hello, world!")
|
|
@ -0,0 +1,6 @@
|
|||
import CartonTests
|
||||
import XCTest
|
||||
|
||||
var tests = [XCTestCaseEntry]()
|
||||
tests += CartonTests.allTests()
|
||||
XCTMain(tests)
|
|
@ -0,0 +1,9 @@
|
|||
import XCTest
|
||||
|
||||
#if !canImport(ObjectiveC)
|
||||
public func allTests() -> [XCTestCaseEntry] {
|
||||
[
|
||||
testCase(CartonTests.allTests),
|
||||
]
|
||||
}
|
||||
#endif
|
|
@ -0,0 +1,47 @@
|
|||
import class Foundation.Bundle
|
||||
import XCTest
|
||||
|
||||
final class CartonTests: 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("carton")
|
||||
|
||||
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