Simplify writing test providers in framework tests

This commit is contained in:
Svyatoslav Scherbina
2020-02-21 14:39:15 +03:00
committed by SvyatoslavScherbina
parent 7b187aa169
commit d75ddfdaf4
+12
View File
@@ -188,6 +188,18 @@ protocol TestProvider {
var tests: [TestCase] { get }
}
class SimpleTestProvider : TestProvider {
var tests: [TestCase] = []
init() {
providers.append(self)
}
func test(_ name: String, _ method: @escaping () throws -> Void) {
tests.append(TestCase(name: name, method: withAutorelease(method)))
}
}
var providers: [TestProvider] = []
private func execute(tests: [TestCase]) {