fork of https://github.com/sourcegraph/zoekt
0

Configure Feed

Select the types of activity you want to include in your feed.

at tngl 1.2 kB View raw
1package main 2 3import ( 4 "testing" 5 "testing/quick" 6 7 "github.com/google/go-cmp/cmp" 8 "github.com/google/go-cmp/cmp/cmpopts" 9) 10 11func TestIndexOptions_RoundTrip(t *testing.T) { 12 var diff string 13 f := func(original indexOptionsItem) bool { 14 var converted indexOptionsItem 15 converted.FromProto(original.ToProto()) 16 17 options := []cmp.Option{ 18 // The CloneURL field doesn't exist in the subset of fields that proto.ZoektIndexOptions contains. 19 cmpopts.IgnoreFields(indexOptionsItem{}, "CloneURL"), 20 } 21 22 if diff = cmp.Diff(original, converted, options...); diff != "" { 23 return false 24 } 25 return true 26 } 27 28 if err := quick.Check(f, nil); err != nil { 29 t.Errorf("indexOptionsItem diff (-want +got):\n%s", diff) 30 } 31} 32 33func TestUpdateIndexStatusRequest_RoundTrip(t *testing.T) { 34 var diff string 35 f := func(original updateIndexStatusRequest) bool { 36 var converted updateIndexStatusRequest 37 converted.FromProto(original.ToProto()) 38 39 options := []cmp.Option{ 40 cmpopts.EquateEmpty(), 41 } 42 43 if diff = cmp.Diff(original, converted, options...); diff != "" { 44 return false 45 } 46 return true 47 } 48 49 if err := quick.Check(f, nil); err != nil { 50 t.Errorf("updateIndexStatusRequest diff (-want +got):\n%s", diff) 51 } 52}