Skip to content

Commit

Permalink
Refactor comparison of byte slices
Browse files Browse the repository at this point in the history
  • Loading branch information
SarahFrench committed Jan 10, 2025
1 parent f4defed commit 168df6a
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion internal/command/artifact/junit_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ func TestJUnitXMLFile_save(t *testing.T) {
t.Fatalf("unexpected error opening file")
}

if bytes.Compare(fileContent, xml) != 0 {
if !bytes.Equal(fileContent, xml) {
t.Fatalf("wanted XML:\n%s\n got XML:\n%s\n", string(xml), string(fileContent))
}
})
Expand Down
2 changes: 1 addition & 1 deletion internal/command/test_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2405,7 +2405,7 @@ func TestTest_JUnitOutput(t *testing.T) {
timestampRegexp := regexp.MustCompile(`timestamp="[^"]+"`)
actualOut = timestampRegexp.ReplaceAll(actualOut, []byte("timestamp=\"TIMESTAMP_REDACTED\""))

if bytes.Compare(actualOut, expectedOutput) != 0 {
if !bytes.Equal(actualOut, expectedOutput) {
t.Fatalf("wanted XML:\n%s\n got XML:\n%s\n", string(expectedOutput), string(actualOut))
}

Expand Down

0 comments on commit 168df6a

Please sign in to comment.