@@ -21,6 +21,8 @@ import (
2121 "testing"
2222 "time"
2323
24+ "github.com/google/go-cmp/cmp"
25+ "github.com/google/go-cmp/cmp/cmpopts"
2426 "github.com/google/go-github/v66/github"
2527)
2628
@@ -110,8 +112,8 @@ func TestUpdateCache(t *testing.T) {
110112 if err != nil {
111113 t .Fatalf ("updateCache failed: %v" , err )
112114 }
113- if ! reflect . DeepEqual (got , tt .want ) {
114- t .Errorf ("unexpected AffectedItem: got %v, want %v " , got , tt . want )
115+ if diff := cmp . Diff (got , tt .want , cmpopts . SortSlices ( func ( a , b string ) bool { return a < b })); diff != "" {
116+ t .Errorf ("unexpected AffectedItem: diff (- want +got): \n %s " , diff )
115117 }
116118 })
117119 }
@@ -223,8 +225,8 @@ func TestGetCacheEntry(t *testing.T) {
223225 t .Errorf ("getCacheEntry() error = %v" , err )
224226 return
225227 }
226- if ! reflect . DeepEqual (got , tt .want ) {
227- t .Errorf ("getCacheEntry() = %v, want %v " , got , tt . want )
228+ if diff := cmp . Diff (got , tt .want , cmpopts . SortSlices ( func ( a , b string ) bool { return a < b })); diff != "" {
229+ t .Errorf ("getCacheEntry() diff (- want +got): \n %s " , diff )
228230 }
229231 })
230232 }
@@ -365,8 +367,8 @@ func TestSaveCache(t *testing.T) {
365367 "hash2"
366368 ]
367369}` )
368- if ! reflect . DeepEqual (savedCacheData , expectedCacheData ) {
369- t .Errorf ("unexpected cache data: got %v, want %v " , savedCacheData , expectedCacheData )
370+ if diff := cmp . Diff (savedCacheData , expectedCacheData , cmpopts . SortSlices ( func ( a , b string ) bool { return a < b })); diff != "" {
371+ t .Errorf ("unexpected AffectedItem: diff (- want +got): \n %s " , diff )
370372 }
371373}
372374
0 commit comments