|
16 | 16 | // FunctionTest("my_new_test") { function, arguments, context in
|
17 | 17 | // }
|
18 | 18 | // - In SwiftCompilerSources/Sources/SIL/Test.swift's registerOptimizerTests
|
19 |
| -// function, register the new test: |
20 |
| -// registerFunctionTest(myNewTest) |
| 19 | +// function, add a new argument to the variadic function: |
| 20 | +// registerFunctionTests(..., myNewTest) |
21 | 21 | //
|
22 | 22 | //===----------------------------------------------------------------------===//
|
23 | 23 | //
|
@@ -100,7 +100,7 @@ struct FunctionTest {
|
100 | 100 | let name: String
|
101 | 101 | let invocation: FunctionTestInvocation
|
102 | 102 |
|
103 |
| - public init(name: String, invocation: @escaping FunctionTestInvocation) { |
| 103 | + public init(_ name: String, invocation: @escaping FunctionTestInvocation) { |
104 | 104 | self.name = name
|
105 | 105 | self.invocation = invocation
|
106 | 106 | }
|
@@ -135,12 +135,19 @@ extension BridgedTestArguments {
|
135 | 135 | /// Registration of each test in the SIL module.
|
136 | 136 | public func registerOptimizerTests() {
|
137 | 137 | // Register each test.
|
138 |
| - registerFunctionTest(parseTestSpecificationTest) |
| 138 | + registerFunctionTests( |
| 139 | + parseTestSpecificationTest, |
| 140 | + forwardingUseDefTest, |
| 141 | + forwardingDefUseTest |
| 142 | + ) |
139 | 143 |
|
140 | 144 | // Finally register the thunk they all call through.
|
141 | 145 | registerFunctionTestThunk(functionTestThunk)
|
142 | 146 | }
|
143 | 147 |
|
| 148 | +private func registerFunctionTests(_ tests: FunctionTest...) { |
| 149 | + tests.forEach { registerFunctionTest($0) } |
| 150 | +} |
144 | 151 |
|
145 | 152 | private func registerFunctionTest(_ test: FunctionTest) {
|
146 | 153 | test.name._withBridgedStringRef { ref in
|
@@ -202,7 +209,7 @@ private func castToInvocation(fromOpaquePointer erasedInvocation: UnsafeMutableR
|
202 | 209 | // - its type
|
203 | 210 | // - something to identify the instance (mostly this means calling dump)
|
204 | 211 | let parseTestSpecificationTest =
|
205 |
| -FunctionTest(name: "test_specification_parsing") { function, arguments, context in |
| 212 | +FunctionTest("test_specification_parsing") { function, arguments, context in |
206 | 213 | let expectedFields = arguments.takeString()
|
207 | 214 | for expectedField in expectedFields.string {
|
208 | 215 | switch expectedField {
|
|
0 commit comments