Skip to content

Commit 5851784

Browse files
committed
update swift --init library tests format
1 parent b354d67 commit 5851784

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

Sources/swift-build/initPackage.swift

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -122,9 +122,9 @@ final class InitPackage {
122122
}
123123
print("Creating Tests/LinuxMain.swift")
124124
try fputs("import XCTest\n", linuxMainFP)
125-
try fputs("@testable import \(pkgname)test\n\n", linuxMainFP)
125+
try fputs("@testable import \(pkgname)TestSuite\n\n", linuxMainFP)
126126
try fputs("XCTMain([\n", linuxMainFP)
127-
try fputs("\t\(pkgname)(),\n", linuxMainFP)
127+
try fputs("\t testCase(\(pkgname).allTests),\n", linuxMainFP)
128128
try fputs("])\n", linuxMainFP)
129129
}
130130

@@ -151,14 +151,12 @@ final class InitPackage {
151151

152152
try fputs("}\n", testsFileFP)
153153

154-
try fputs("\n#if os(Linux)\n", testsFileFP)
155-
try fputs("extension \(pkgname): XCTestCaseProvider {\n", testsFileFP)
156-
try fputs("\tvar allTests : [(String, () throws -> Void)] {\n", testsFileFP)
154+
try fputs("extension \(pkgname) {\n", testsFileFP)
155+
try fputs("\tstatic var allTests : [(String, \(pkgname) -> () throws -> Void)] {\n", testsFileFP)
157156
try fputs("\t\treturn [\n", testsFileFP)
158157
try fputs("\t\t\t(\"testExample\", testExample),\n", testsFileFP)
159158
try fputs("\t\t]\n", testsFileFP)
160159
try fputs("\t}\n", testsFileFP)
161160
try fputs("}\n", testsFileFP)
162-
try fputs("#endif\n", testsFileFP)
163161
}
164162
}

0 commit comments

Comments
 (0)