-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
motivation: Swift 5.1 introduced the --enable-test-discovery flag which instructs SwiftPM to discover tests instead of relying on a test manifest file named LinuxMain.swift. This functionality has been pretty well adopted and we are making it the default changes: * deprecate --enable-test-discovery flag * deprecate --generate-linuxmain flag * automatically detect tests on non-darwin platforms * support "XCTMain.swift", "LinuxMain.swift" as escape hatch when test discovery is not appropriate. This files take priority. * `package init` no longet generate LinuxMain.swift * add and adjust tests
- Loading branch information
Showing
30 changed files
with
376 additions
and
568 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
// swift-tools-version:4.2 | ||
import PackageDescription | ||
|
||
let package = Package( | ||
name: "Simple", | ||
targets: [ | ||
.target(name: "Simple"), | ||
.testTarget(name: "SimpleTests", dependencies: ["Simple"]), | ||
] | ||
) |
3 changes: 3 additions & 0 deletions
3
Fixtures/Miscellaneous/TestDiscovery/Simple/Sources/Simple/Simple.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
struct Simple { | ||
|
||
} |
17 changes: 17 additions & 0 deletions
17
Fixtures/Miscellaneous/TestDiscovery/Simple/Tests/SimpleTests/SwiftTests.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import XCTest | ||
@testable import Simple | ||
|
||
class SimpleTests: XCTestCase { | ||
|
||
func testExample1() { | ||
} | ||
|
||
func test_Example2() { | ||
} | ||
|
||
func testExample3(arg: String) { | ||
} | ||
|
||
func nontest() { | ||
} | ||
} |
28 changes: 28 additions & 0 deletions
28
Fixtures/Miscellaneous/TestDiscovery/hello world/Package.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
// swift-tools-version:5.3 | ||
// The swift-tools-version declares the minimum version of Swift required to build this package. | ||
|
||
import PackageDescription | ||
|
||
let package = Package( | ||
name: "hello world", | ||
products: [ | ||
// Products define the executables and libraries a package produces, and make them visible to other packages. | ||
.library( | ||
name: "hello world", | ||
targets: ["hello world"]), | ||
], | ||
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 this package depends on. | ||
.target( | ||
name: "hello world", | ||
dependencies: []), | ||
.testTarget( | ||
name: "hello world tests", | ||
dependencies: ["hello world"]), | ||
] | ||
) |
3 changes: 3 additions & 0 deletions
3
Fixtures/Miscellaneous/TestDiscovery/hello world/Sources/hello world/hello world.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
struct hello_world { | ||
var text = "Hello, World!" | ||
} |
11 changes: 11 additions & 0 deletions
11
...s/Miscellaneous/TestDiscovery/hello world/Tests/hello world tests/hello world tests.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import XCTest | ||
@testable import hello_world | ||
|
||
final class hello_worldTests: XCTestCase { | ||
func testExample() { | ||
// This is an example of a functional test case. | ||
// Use XCTAssert and related functions to verify your tests produce the correct | ||
// results. | ||
XCTAssertEqual(hello_world().text, "Hello, World!") | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.