Skip to content

Commit 6dffe60

Browse files
committed
consolidate tests into single swift-hello-world test
This exercises the test and C++ interop package and feature, respectively
1 parent d6f95e6 commit 6dffe60

File tree

11 files changed

+46
-63
lines changed

11 files changed

+46
-63
lines changed

recipes-test/swift-hello-world/files/Package.swift

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// swift-tools-version:5.6
1+
// swift-tools-version:6.0
22
// The swift-tools-version declares the minimum version of Swift required to build this package.
33

44
import PackageDescription
@@ -12,8 +12,16 @@ let package = Package(
1212
targets: [
1313
// Targets are the basic building blocks of a package. A target can define a module or a test suite.
1414
// Targets can depend on other targets in this package, and on products in packages which this package depends on.
15-
.target(
15+
.executableTarget(
1616
name: "hello-world",
17-
dependencies: [])
17+
dependencies: [],
18+
swiftSettings: [
19+
.swiftLanguageMode(.v5),
20+
.interoperabilityMode(.Cxx),
21+
]
22+
),
23+
.testTarget(
24+
name: "hello-world-test",
25+
dependencies: []),
1826
]
1927
)

recipes-test/swift-hello-world/files/Sources/hello-world/main.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
import Foundation
22
import Dispatch
33
import Glibc
4+
import CxxStdlib
45

56
func main() async throws {
67
print("Hello, world! 👋")
7-
try await Task.sleep(1_000_000_000)
8+
try await Task.sleep(for: .seconds(1))
89
print("User: \(ProcessInfo.processInfo.fullUserName)")
910
let dateFormatter = DateFormatter()
1011
dateFormatter.dateStyle = .full
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import XCTest
2+
import Testing
3+
4+
final class TestTest: XCTestCase {
5+
func testSomething() {
6+
XCTAssertEqual(true, true)
7+
}
8+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import XCTest
2+
3+
final class TestTest: XCTestCase {
4+
func testEqual() throws {
5+
XCTAssertEqual(true, true)
6+
}
7+
}
Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,23 @@
1-
DESCRIPTION = "swift 5.6.1 test application"
1+
DESCRIPTION = "Swift Hello World!"
22
LICENSE = "CLOSED"
33

4-
SRC_URI = "file://Sources/hello-world/main.swift \
5-
file://Package.swift \
4+
SWIFT_BUILD_TESTS = "1"
5+
6+
RDEPENDS:${PN} += "swift-xctest swift-testing"
7+
8+
SRC_URI = "\
9+
file://Package.swift \
10+
file://Sources \
11+
file://Tests \
612
"
713

14+
S = "${WORKDIR}/git"
15+
B = "${WORKDIR}/build"
16+
817
inherit swift
18+
19+
do_install() {
20+
install -d ${D}${bindir}
21+
install -m 0755 ${BUILD_DIR}/hello-world ${D}${bindir}
22+
install -m 0755 ${BUILD_DIR}/hello-worldPackageTests.xctest ${D}${bindir}
23+
}

recipes-test/swift/swift-build-test.bb

Lines changed: 0 additions & 9 deletions
This file was deleted.

recipes-test/swift/swift-build-test/Package.swift

Lines changed: 0 additions & 19 deletions
This file was deleted.

recipes-test/swift/swift-build-test/Sources/hello-world/main.swift

Lines changed: 0 additions & 4 deletions
This file was deleted.

recipes-test/swift/swift-cmake-test.bb

Lines changed: 0 additions & 12 deletions
This file was deleted.

recipes-test/swift/swift-cmake-test/CMakeLists.txt

Lines changed: 0 additions & 8 deletions
This file was deleted.

0 commit comments

Comments
 (0)