Commit fbe6bb8b authored by Drew's avatar Drew

Tests should error when they fail.

That way we get nice pretty CI coverage
parent d34cbe3d
......@@ -13,6 +13,7 @@
// limitations under the License.
// NOTE: This is the crappiest test thing ever... but it works for now.
import Foundation
extension String : ErrorType {}
......@@ -27,23 +28,26 @@ enum test {
protocol Test {
init()
func runTests()
func runTests() -> Bool
var tests: [() throws -> ()] { get }
var filename: String { get }
}
extension Test {
func runTests() {
func runTests() -> Bool {
print("Tests for \(filename)")
var passed = true
for test in tests {
do {
try test()
}
catch {
print("\(filename): **FAILED** \(error)")
passed = false
}
}
return passed
}
}
......@@ -58,8 +62,10 @@ let tests: [Test] = [
PackageTests()
]
var passed = true
for test in tests {
test.runTests()
passed = passed && test.runTests()
}
print()
\ No newline at end of file
print()
if !passed { exit(1) }
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment