Skip to content

Commit e8f028f

Browse files
committed
test helpers: do not use default build system
Many of the executeSwift* command helpers accept a build system provider, which was defaulted to the native build system. Since we are augmenting the tests to also run against the SwiftBuild, setting a default value may lead to an undesirable test behaviour. Update all the executeSwift* commands to no set a default build system provider.
1 parent 59f3e8d commit e8f028f

File tree

54 files changed

+1430
-622
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+1430
-622
lines changed
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
// swift-tools-version: 5.6
2+
import PackageDescription
3+
let package = Package(
4+
name: "MyPackage",
5+
products: [
6+
.library(
7+
name: "MyLibrary",
8+
targets: ["MyLibrary"]
9+
),
10+
.executable(
11+
name: "MyExecutable",
12+
targets: ["MyExecutable"]
13+
),
14+
],
15+
targets: [
16+
.target(
17+
name: "MyLibrary"
18+
),
19+
.executableTarget(
20+
name: "MyExecutable",
21+
dependencies: ["MyLibrary"]
22+
),
23+
.plugin(
24+
name: "MyCommandPlugin",
25+
capability: .command(
26+
intent: .custom(verb: "my-build-tester", description: "Help description")
27+
)
28+
),
29+
]
30+
)
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import PackagePlugin
2+
@main struct MyCommandPlugin: CommandPlugin {
3+
func performCommand(
4+
context: PluginContext,
5+
arguments: [String]
6+
) throws {
7+
this is an error
8+
}
9+
}
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
import MyLibrary
2+
print("\\(GetGreeting()), World!")
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
public func GetGreeting() -> String { return "Hello" }
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
// swift-tools-version: 5.6
2+
import PackageDescription
3+
let package = Package(
4+
name: "MyPackage",
5+
products: [
6+
.library(
7+
name: "MyLibrary",
8+
targets: ["MyLibrary"]
9+
),
10+
.executable(
11+
name: "MyExecutable",
12+
targets: ["MyExecutable"]
13+
),
14+
],
15+
targets: [
16+
.target(
17+
name: "MyLibrary"
18+
),
19+
.executableTarget(
20+
name: "MyExecutable",
21+
dependencies: ["MyLibrary"]
22+
),
23+
.plugin(
24+
name: "MyBuildToolPlugin",
25+
capability: .buildTool()
26+
),
27+
.plugin(
28+
name: "MyCommandPlugin",
29+
capability: .command(
30+
intent: .custom(verb: "my-build-tester", description: "Help description")
31+
)
32+
),
33+
]
34+
)
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import PackagePlugin
2+
@main struct MyBuildToolPlugin: BuildToolPlugin {
3+
func createBuildCommands(
4+
context: PluginContext,
5+
target: Target
6+
) throws -> [Command] {
7+
return []
8+
}
9+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import PackagePlugin
2+
@main struct MyCommandPlugin: CommandPlugin {
3+
func performCommand(
4+
context: PluginContext,
5+
arguments: [String]
6+
) throws {
7+
}
8+
}
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
import MyLibrary
2+
print("\\(GetGreeting()), World!")
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
public func GetGreeting() -> String { return "Hello" }

Fixtures/Miscellaneous/Unicode/Package.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ let complicatedString = "πשּׁµ𝄞🇺🇳🇮🇱x̱̱̱̱̱̄̄̄̄̄"
1313
// 🇮🇱 U+1F1EE U+1F1F1: Second consecutive regional indicator. (Complicated grapheme breaking.)
1414
// x̱̱̱̱̱̄̄̄̄̄ U+0078 (U+0331 U+0304) × 5: Extremely long combining sequence. (Also reordrant under normalization.)
1515

16-
// The following verifies that sources havent been normalized, which would reduce the tests effectiveness.
16+
// The following verifies that sources haven't been normalized, which would reduce the test's effectiveness.
1717
var verify = "\u{03C0}\u{0FB2C}\u{00B5}\u{1D11E}\u{1F1FA}\u{1F1F3}\u{1F1EE}\u{1F1F1}\u{0078}\u{0331}\u{0304}\u{0331}\u{0304}\u{0331}\u{0304}\u{0331}\u{0304}\u{0331}\u{0304}"
1818
assert(
1919
complicatedString.unicodeScalars.elementsEqual(verify.unicodeScalars),

0 commit comments

Comments
 (0)