Skip to content

Commit aa563d3

Browse files
committed
Add SwiftProtobufTestHelpers.
This is a library that isn't exported but will hold helpers that multiple tests can now make use of.
1 parent c5b3769 commit aa563d3

File tree

10 files changed

+29
-12
lines changed

10 files changed

+29
-12
lines changed

Package.swift

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,13 +37,17 @@ let package = Package(
3737
targets: [
3838
.target(
3939
name: "SwiftProtobuf",
40-
exclude: ["CMakeLists.txt"]
40+
exclude: ["CMakeLists.txt"]
4141
),
4242
.target(
4343
name: "SwiftProtobufPluginLibrary",
4444
dependencies: ["SwiftProtobuf"],
4545
exclude: ["CMakeLists.txt"]
4646
),
47+
.target(
48+
name: "SwiftProtobufTestHelpers",
49+
dependencies: ["SwiftProtobuf"]
50+
),
4751
.executableTarget(
4852
name: "protoc-gen-swift",
4953
dependencies: ["SwiftProtobufPluginLibrary", "SwiftProtobuf"],
@@ -67,7 +71,7 @@ let package = Package(
6771
),
6872
.testTarget(
6973
name: "SwiftProtobufPluginLibraryTests",
70-
dependencies: ["SwiftProtobufPluginLibrary"]
74+
dependencies: ["SwiftProtobufPluginLibrary", "SwiftProtobufTestHelpers"]
7175
),
7276
.testTarget(
7377
name: "protoc-gen-swiftTests",

[email protected]

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,16 @@ let package = Package(
2222
.target(name: "SwiftProtobuf"),
2323
.target(name: "SwiftProtobufPluginLibrary",
2424
dependencies: ["SwiftProtobuf"]),
25+
.target(name: "SwiftProtobufTestHelpers",
26+
dependencies: ["SwiftProtobuf"]),
2527
.target(name: "protoc-gen-swift",
2628
dependencies: ["SwiftProtobufPluginLibrary", "SwiftProtobuf"]),
2729
.target(name: "Conformance",
2830
dependencies: ["SwiftProtobuf"]),
2931
.testTarget(name: "SwiftProtobufTests",
3032
dependencies: ["SwiftProtobuf"]),
3133
.testTarget(name: "SwiftProtobufPluginLibraryTests",
32-
dependencies: ["SwiftProtobufPluginLibrary"]),
34+
dependencies: ["SwiftProtobufPluginLibrary", "SwiftProtobufTestHelpers"]),
3335
],
3436
swiftLanguageVersions: [.v5]
3537
)

[email protected]

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,16 @@ let package = Package(
2222
.target(name: "SwiftProtobuf"),
2323
.target(name: "SwiftProtobufPluginLibrary",
2424
dependencies: ["SwiftProtobuf"]),
25+
.target(name: "SwiftProtobufTestHelpers",
26+
dependencies: ["SwiftProtobuf"]),
2527
.target(name: "protoc-gen-swift",
2628
dependencies: ["SwiftProtobufPluginLibrary", "SwiftProtobuf"]),
2729
.target(name: "Conformance",
2830
dependencies: ["SwiftProtobuf"]),
2931
.testTarget(name: "SwiftProtobufTests",
3032
dependencies: ["SwiftProtobuf"]),
3133
.testTarget(name: "SwiftProtobufPluginLibraryTests",
32-
dependencies: ["SwiftProtobufPluginLibrary"]),
34+
dependencies: ["SwiftProtobufPluginLibrary", "SwiftProtobufTestHelpers"]),
3335
],
3436
swiftLanguageVersions: [.v5]
3537
)

[email protected]

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,16 @@ let package = Package(
2222
.target(name: "SwiftProtobuf"),
2323
.target(name: "SwiftProtobufPluginLibrary",
2424
dependencies: ["SwiftProtobuf"]),
25+
.target(name: "SwiftProtobufTestHelpers",
26+
dependencies: ["SwiftProtobuf"]),
2527
.target(name: "protoc-gen-swift",
2628
dependencies: ["SwiftProtobufPluginLibrary", "SwiftProtobuf"]),
2729
.target(name: "Conformance",
2830
dependencies: ["SwiftProtobuf"]),
2931
.testTarget(name: "SwiftProtobufTests",
3032
dependencies: ["SwiftProtobuf"]),
3133
.testTarget(name: "SwiftProtobufPluginLibraryTests",
32-
dependencies: ["SwiftProtobufPluginLibrary"]),
34+
dependencies: ["SwiftProtobufPluginLibrary", "SwiftProtobufTestHelpers"]),
3335
],
3436
swiftLanguageVersions: [.v5]
3537
)

[email protected]

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,16 @@ let package = Package(
2222
.target(name: "SwiftProtobuf"),
2323
.target(name: "SwiftProtobufPluginLibrary",
2424
dependencies: ["SwiftProtobuf"]),
25+
.target(name: "SwiftProtobufTestHelpers",
26+
dependencies: ["SwiftProtobuf"]),
2527
.target(name: "protoc-gen-swift",
2628
dependencies: ["SwiftProtobufPluginLibrary", "SwiftProtobuf"]),
2729
.target(name: "Conformance",
2830
dependencies: ["SwiftProtobuf"]),
2931
.testTarget(name: "SwiftProtobufTests",
3032
dependencies: ["SwiftProtobuf"]),
3133
.testTarget(name: "SwiftProtobufPluginLibraryTests",
32-
dependencies: ["SwiftProtobufPluginLibrary"]),
34+
dependencies: ["SwiftProtobufPluginLibrary", "SwiftProtobufTestHelpers"]),
3335
],
3436
swiftLanguageVersions: [.v5]
3537
)

[email protected]

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,16 @@ let package = Package(
2222
.target(name: "SwiftProtobuf"),
2323
.target(name: "SwiftProtobufPluginLibrary",
2424
dependencies: ["SwiftProtobuf"]),
25+
.target(name: "SwiftProtobufTestHelpers",
26+
dependencies: ["SwiftProtobuf"]),
2527
.target(name: "protoc-gen-swift",
2628
dependencies: ["SwiftProtobufPluginLibrary", "SwiftProtobuf"]),
2729
.target(name: "Conformance",
2830
dependencies: ["SwiftProtobuf"]),
2931
.testTarget(name: "SwiftProtobufTests",
3032
dependencies: ["SwiftProtobuf"]),
3133
.testTarget(name: "SwiftProtobufPluginLibraryTests",
32-
dependencies: ["SwiftProtobufPluginLibrary"]),
34+
dependencies: ["SwiftProtobufPluginLibrary", "SwiftProtobufTestHelpers"]),
3335
],
3436
swiftLanguageVersions: [.v5]
3537
)

[email protected]

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,16 @@ let package = Package(
2222
.target(name: "SwiftProtobuf"),
2323
.target(name: "SwiftProtobufPluginLibrary",
2424
dependencies: ["SwiftProtobuf"]),
25+
.target(name: "SwiftProtobufTestHelpers",
26+
dependencies: ["SwiftProtobuf"]),
2527
.target(name: "protoc-gen-swift",
2628
dependencies: ["SwiftProtobufPluginLibrary", "SwiftProtobuf"]),
2729
.target(name: "Conformance",
2830
dependencies: ["SwiftProtobuf"]),
2931
.testTarget(name: "SwiftProtobufTests",
3032
dependencies: ["SwiftProtobuf"]),
3133
.testTarget(name: "SwiftProtobufPluginLibraryTests",
32-
dependencies: ["SwiftProtobufPluginLibrary"]),
34+
dependencies: ["SwiftProtobufPluginLibrary", "SwiftProtobufTestHelpers"]),
3335
],
3436
swiftLanguageVersions: [.v5]
3537
)

Tests/SwiftProtobufPluginLibraryTests/Descriptor+TestHelpers.swift renamed to Sources/SwiftProtobufTestHelpers/Descriptor+TestHelpers.swift

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,8 @@
99
// -----------------------------------------------------------------------------
1010

1111
import SwiftProtobuf
12-
import SwiftProtobufPluginLibrary
1312

14-
extension Google_Protobuf_FileDescriptorProto {
13+
public extension Google_Protobuf_FileDescriptorProto {
1514
init(name: String, dependencies: [String] = [], publicDependencies: [Int32] = []) {
1615
for idx in publicDependencies { precondition(Int(idx) <= dependencies.count) }
1716
self.init()
@@ -25,7 +24,7 @@ extension Google_Protobuf_FileDescriptorProto {
2524
}
2625
}
2726

28-
extension Google_Protobuf_FileDescriptorSet {
27+
public extension Google_Protobuf_FileDescriptorSet {
2928
init(files: [Google_Protobuf_FileDescriptorProto]) {
3029
self.init()
3130
file = files
@@ -36,7 +35,7 @@ extension Google_Protobuf_FileDescriptorSet {
3635
}
3736
}
3837

39-
extension Google_Protobuf_EnumValueDescriptorProto {
38+
public extension Google_Protobuf_EnumValueDescriptorProto {
4039
init(name: String, number: Int32) {
4140
self.init()
4241
self.name = name

Tests/SwiftProtobufPluginLibraryTests/Test_ProtoFileToModuleMappings.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010

1111
import XCTest
1212
import SwiftProtobuf
13+
import SwiftProtobufTestHelpers
1314
@testable import SwiftProtobufPluginLibrary
1415

1516
// Support equality to simplify testing of getting the correct errors.

Tests/SwiftProtobufPluginLibraryTests/Test_SwiftProtobufNamer.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
import XCTest
1212
import SwiftProtobuf
1313
import SwiftProtobufPluginLibrary
14+
import SwiftProtobufTestHelpers
1415

1516
class Test_SwiftProtobufNamer: XCTestCase {
1617

0 commit comments

Comments
 (0)