Commit f0193f20 authored by Drew's avatar Drew

Add "check" to deal with Swift2Errors

parent 26cd0d71
......@@ -105,6 +105,16 @@ extension CarolineTest {
}
}
///Check that a function does not return an error
public final func check(_ message: @autoclosure() -> String = "Error thrown", file: String = #file, line: Int = #line, block: () throws -> ()) {
do {
try block()
}
catch {
self.fail("\(message()) - \(error)", file: file, line: line)
}
}
///Assert that the passed closure doesn't throw
///- returns: nil if the calling closure throws, otherwise the return value.
......
......@@ -19,11 +19,15 @@ import CarolineCore
let allTests: [CarolineTest] = [
AssertTrue(),
AssertFalse(),
DictEqual(),
DictEqualInverse(),
DictEqualLengthMismatch(),
DictNotEqual(),
DictNotEqualInverse(),
DictNotEqualLengthMismatch(),
NoErrorCheck(),
ErrorCheck(),
Fail(),
SimpleEqual(),
SimpleEqualInverse(),
SimpleNotEqual(),
SimpleNotEqualInverse(),
SequenceEqual(),
SequenceEqualInverse(),
SequenceEqualLengthA(),
......@@ -36,12 +40,10 @@ let allTests: [CarolineTest] = [
SequenceNotEqualLengthB(),
SequenceNotEqualLengthC(),
SequenceNotEqualLengthD(),
DictEqual(),
DictEqualInverse(),
DictEqualLengthMismatch(),
DictNotEqual(),
DictNotEqualInverse(),
DictNotEqualLengthMismatch()
SimpleEqual(),
SimpleEqualInverse(),
SimpleNotEqual(),
SimpleNotEqualInverse()
]
let engine = CarolineCoreEngine()
if !engine.testAll(allTests) {
......
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