Skip to content

Commit

Permalink
No need to compare arrays item-by-item if they are the same object.
Browse files Browse the repository at this point in the history
RELNOTES=none

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=293028181
  • Loading branch information
Darida authored and cpovirk committed Feb 4, 2020
1 parent 0224e21 commit 0d379b5
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions core/src/main/java/com/google/common/truth/Subject.java
Original file line number Diff line number Diff line change
Expand Up @@ -536,6 +536,9 @@ private static ComparisonResult checkByteArrayEquals(byte[] expected, byte[] act
*/
private static ComparisonResult checkArrayEqualsRecursive(
Object expectedArray, Object actualArray, String lastIndex) {
if (expectedArray == actualArray) {
return ComparisonResult.equal();
}
String expectedType = arrayType(expectedArray);
String actualType = arrayType(actualArray);
if (!expectedType.equals(actualType)) {
Expand Down

0 comments on commit 0d379b5

Please sign in to comment.