Skip to content

Commit

Permalink
Fix LineByLineComparison bug when expected is longer than actual
Browse files Browse the repository at this point in the history
  • Loading branch information
calvincestari committed Mar 10, 2022
1 parent 4b44673 commit be6f371
Showing 1 changed file with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public func equalLineByLine(
} else {
return PredicateResult(
status: .fail,
message: .fail("Expected \(expectedLines.count), actual ended at line \(index).")
message: .fail("Expected \(expectedLines.count), actual ended at line \(actualLines.count)")
)
}
}
Expand All @@ -52,6 +52,13 @@ public func equalLineByLine(
}
}

guard expectedLinesBuffer.isEmpty else {
return PredicateResult(
status: .fail,
message: .fail("Expected \(expectedLines.count), actual ended at line \(actualLines.count).")
)
}

return PredicateResult(
status: .matches,
message: .expectedTo("be equal")
Expand Down

0 comments on commit be6f371

Please sign in to comment.