I'm experiencing an issue with the report of code coverage in Xcode. As you can see from this screenshot:
On the left tab, line 58 is "touched" from the break-point, and on the right tab, the test passes. While on the right tab, I'm running only the test on line 37.
Why does Xcode sign the line 58 in red, as not covered?
Line 53 is not "touched" (if I set a break-point there). Using SQLite as a database.
The entire project is available here.
EDIT: Adding code:
Test.swift
func testAddFuelFail() {
fuelsManager.dropTable()
XCTAssertEqual(addFuel(), -1)
}
FuelsManager.swift
func addFuel(dateOfFuel: Date, mileageOnSave: Int, quantityOfFuel: Double, pricePerUnitOfFuel: Double) -> Int64 {
let insertFuel = fuelsTable.insert(date <- dateOfFuel, mileage <- mileageOnSave, quantity <- quantityOfFuel, pricePerUnit <- pricePerUnitOfFuel)
do {
let id = try database!.run(insertFuel)
return id
} catch {
print(error)
}
return -1
}