Commit b7614a41 authored by Drew's avatar Drew

Swift 2.2 backport

parent 18a41527
......@@ -14,6 +14,7 @@
//MARK: Functions
extension CarolineTest {
#if swift(>=3.0)
public final func assert(_ condition: @autoclosure () -> Bool, _ message: @autoclosure () -> String = "Test failed", file: String = #file, line: Int = #line) {
if !condition() {
var state = CarolineState(test: self)
......@@ -22,4 +23,14 @@ extension CarolineTest {
print("Test failed at \(file):\(line) - \(message())")
}
}
#else
public final func assert(@autoclosure _ condition: () -> Bool, @autoclosure _ message: () -> String = "Test failed", file: String = #file, line: Int = #line) {
if !condition() {
var state = CarolineState(test: self)
state.outcome = .Failed
state.commit()
print("Test failed at \(file):\(line) - \(message())")
}
}
#endif
}
\ 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