Commit 4a9eae46 authored by Drew's avatar Drew

Adding file and line numbers to test failures

parent 46f0409c
Pipeline #2191 passed with stages
in 51 minutes and 49 seconds
......@@ -73,43 +73,43 @@ extension CarolineTest {
#if swift(>=3.0)
public final func assert<T: Equatable>(_ a: T, equals b: T, _ message: @autoclosure () -> String = "Assertion failed", file: String = #file, line: Int = #line) {
if a != b {
self.fail("\(message()) - \(a) != \(b)")
self.fail("\(message()) - \(a) != \(b)", file: file, line: line)
}
}
public final func assert<T: Equatable>(_ a: T, notEqual b: T, _ message: @autoclosure () -> String = "Assertion failed", file: String = #file, line: Int = #line) {
if a == b {
self.fail("\(message()) - \(a) == \(b)")
self.fail("\(message()) - \(a) == \(b)", file: file, line: line)
}
}
public final func assert<T:Sequence where T.Iterator.Element: Equatable>(_ a: T, equals b: T, _ message: @autoclosure () -> String = "Assertion failed", file: String = #file, line: Int = #line) {
if !compare(a,b) {
self.fail("\(message()) - \(a) != \(b)")
self.fail("\(message()) - \(a) != \(b)", file: file, line: line)
}
}
public final func assert<T:Sequence where T.Iterator.Element: Equatable>(_ a: T, notEqual b: T, _ message: @autoclosure () -> String = "Assertion failed", file: String = #file, line: Int = #line) {
if compare(a,b) {
self.fail("\(message()) - \(a) == \(b)")
self.fail("\(message()) - \(a) == \(b)", file: file, line: line)
}
}
#else
public final func assert<T: Equatable>(_ a: T, equals b: T, @autoclosure _ message: () -> String = "Assertion failed", file: String = #file, line: Int = #line) {
if a != b {
self.fail("\(message()) - \(a) != \(b)")
self.fail("\(message()) - \(a) != \(b)", file: file, line: line)
}
}
public final func assert<T: Equatable>(_ a: T, notEqual b: T, @autoclosure _ message: () -> String = "Assertion failed", file: String = #file, line: Int = #line) {
if a == b {
self.fail("\(message()) - \(a) == \(b)")
self.fail("\(message()) - \(a) == \(b)", file: file, line: line)
}
}
public final func assert<T:SequenceType where T.Generator.Element: Equatable>(_ a: T, equals b: T, @autoclosure _ message: () -> String = "Assertion failed", file: String = #file, line: Int = #line) {
if !compare(a,b) {
self.fail("\(message()) - \(a) != \(b)")
self.fail("\(message()) - \(a) != \(b)", file: file, line: line)
}
}
public final func assert<T:SequenceType where T.Generator.Element: Equatable>(_ a: T, notEqual b: T, @autoclosure _ message: () -> String = "Assertion failed", file: String = #file, line: Int = #line) {
if compare(a,b) {
self.fail("\(message()) - \(a) == \(b)")
self.fail("\(message()) - \(a) == \(b)", file: file, line: line)
}
}
#endif
......
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