Skip to content

Commit d0243d6

Browse files
committed
initial commit
0 parents  commit d0243d6

File tree

6 files changed

+69
-0
lines changed

6 files changed

+69
-0
lines changed

Diff for: Package.swift

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
// swift-tools-version:5.1
2+
// The swift-tools-version declares the minimum version of Swift required to build this package.
3+
4+
import PackageDescription
5+
6+
let package = Package(
7+
name: "hello-lib",
8+
products: [
9+
// Products define the executables and libraries produced by a package, and make them visible to other packages.
10+
.library(
11+
name: "hello-lib",
12+
targets: ["hello-lib"]),
13+
],
14+
dependencies: [
15+
// Dependencies declare other packages that this package depends on.
16+
// .package(url: /* package url */, from: "1.0.0"),
17+
],
18+
targets: [
19+
// Targets are the basic building blocks of a package. A target can define a module or a test suite.
20+
// Targets can depend on other targets in this package, and on products in packages which this package depends on.
21+
.target(
22+
name: "hello-lib",
23+
dependencies: []),
24+
.testTarget(
25+
name: "hello-libTests",
26+
dependencies: ["hello-lib"]),
27+
]
28+
)

Diff for: README.md

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# hello-lib
2+
3+
A description of this package.

Diff for: Sources/hello-lib/hello_lib.swift

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
struct hello_lib {
2+
var text = "Hello, World!"
3+
4+
func sayHello() {
5+
print(text)
6+
}
7+
}

Diff for: Tests/LinuxMain.swift

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import XCTest
2+
3+
import hello_libTests
4+
5+
var tests = [XCTestCaseEntry]()
6+
tests += hello_libTests.allTests()
7+
XCTMain(tests)

Diff for: Tests/hello-libTests/XCTestManifests.swift

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import XCTest
2+
3+
#if !canImport(ObjectiveC)
4+
public func allTests() -> [XCTestCaseEntry] {
5+
return [
6+
testCase(hello_libTests.allTests),
7+
]
8+
}
9+
#endif

Diff for: Tests/hello-libTests/hello_libTests.swift

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import XCTest
2+
@testable import hello_lib
3+
4+
final class hello_libTests: XCTestCase {
5+
func testExample() {
6+
// This is an example of a functional test case.
7+
// Use XCTAssert and related functions to verify your tests produce the correct
8+
// results.
9+
XCTAssertEqual(hello_lib().text, "Hello, World!")
10+
}
11+
12+
static var allTests = [
13+
("testExample", testExample),
14+
]
15+
}

0 commit comments

Comments
 (0)