data/fs: faster comparison in tests

This commit is contained in:
Michael Eischer
2026-06-20 19:46:22 +02:00
parent f91afb2fa8
commit 18e5c446e0
2 changed files with 7 additions and 3 deletions
+4 -2
View File
@@ -5,6 +5,7 @@ import (
"fmt"
"os"
"path/filepath"
"reflect"
"testing"
"time"
@@ -275,11 +276,12 @@ func TestApplyPolicy(t *testing.T) {
cmpOpts := cmpopts.IgnoreUnexported(data.Snapshot{})
if !cmp.Equal(want.Keep, keep, cmpOpts) {
// reflect.DeepEqual is faster than cmp.Equal
if !reflect.DeepEqual(want.Keep, keep) {
t.Error(cmp.Diff(want.Keep, keep, cmpOpts))
}
if !cmp.Equal(want.Reasons, reasons, cmpOpts) {
if !reflect.DeepEqual(want.Reasons, reasons) {
t.Error(cmp.Diff(want.Reasons, reasons, cmpOpts))
}
})