Support having multiple files in framework tests
This commit is contained in:
committed by
SvyatoslavScherbina
parent
09be2b2cbf
commit
3b27cb512c
@@ -11,7 +11,7 @@ func testGh3343() throws {
|
|||||||
|
|
||||||
// -------- Execution of the test --------
|
// -------- Execution of the test --------
|
||||||
|
|
||||||
class Gh3343Tests : TestProvider {
|
class UselibTests : TestProvider {
|
||||||
var tests: [TestCase] = []
|
var tests: [TestCase] = []
|
||||||
|
|
||||||
init() {
|
init() {
|
||||||
|
|||||||
@@ -132,12 +132,15 @@ private func execute(tests: [TestCase]) {
|
|||||||
* Entry point of the test
|
* Entry point of the test
|
||||||
*/
|
*/
|
||||||
private func main() {
|
private func main() {
|
||||||
// Generated method that instantiates TestProvider
|
// Generated method that instantiates test providers.
|
||||||
registerProvider()
|
registerProviders()
|
||||||
|
|
||||||
let stats = Statistics.getInstance()
|
let stats = Statistics.getInstance()
|
||||||
for pr in providers {
|
for pr in providers {
|
||||||
|
let name = String(describing: type(of: pr))
|
||||||
|
print("-- \(name) started")
|
||||||
execute(tests: pr.tests)
|
execute(tests: pr.tests)
|
||||||
|
print("-- \(name) finished")
|
||||||
}
|
}
|
||||||
print(stats)
|
print(stats)
|
||||||
|
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ func testIsolation3() throws {
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
class MultipleFrameworksTests : TestProvider {
|
class MultipleTests : TestProvider {
|
||||||
var tests: [TestCase] = []
|
var tests: [TestCase] = []
|
||||||
|
|
||||||
init() {
|
init() {
|
||||||
|
|||||||
@@ -275,7 +275,7 @@ func testGenericExtensions() throws {
|
|||||||
|
|
||||||
// -------- Execution of the test --------
|
// -------- Execution of the test --------
|
||||||
|
|
||||||
class ValuesGenericsTests : TestProvider {
|
class ValuesTests : TestProvider {
|
||||||
var tests: [TestCase] = []
|
var tests: [TestCase] = []
|
||||||
|
|
||||||
init() {
|
init() {
|
||||||
|
|||||||
@@ -80,13 +80,16 @@ open class FrameworkTest : DefaultTask(), KonanTestExecutable {
|
|||||||
|
|
||||||
// create a test provider and get main entry point
|
// create a test provider and get main entry point
|
||||||
val provider = Paths.get(testOutput, testName, "provider.swift")
|
val provider = Paths.get(testOutput, testName, "provider.swift")
|
||||||
FileWriter(provider.toFile()).use {
|
FileWriter(provider.toFile()).use { writer ->
|
||||||
it.write("""
|
val providers = swiftSources
|
||||||
|
.map { Paths.get(it).fileName.toString().removeSuffix(".swift").capitalize() }
|
||||||
|
.map { "${it}Tests" }
|
||||||
|
|
||||||
|
writer.write("""
|
||||||
|// THIS IS AUTOGENERATED FILE
|
|// THIS IS AUTOGENERATED FILE
|
||||||
|// This method is invoked by the main routine to get a list of tests
|
|// This method is invoked by the main routine to get a list of tests
|
||||||
|func registerProvider() {
|
|func registerProviders() {
|
||||||
| // TODO: assuming this naming for now
|
| ${providers.joinToString("\n ") { "$it()" }}
|
||||||
| ${testName}Tests()
|
|
||||||
|}
|
|}
|
||||||
""".trimMargin())
|
""".trimMargin())
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user