@@ -141,9 +141,53 @@ func TestWithReporterNow(t *testing.T) {
141141 }
142142}
143143
144+ // go test -v -cover -run=^TestWithRecordMissed$
145+ func TestWithRecordMissed (t * testing.T ) {
146+ got := & reportConfig {recordMissed : false }
147+ expect := & reportConfig {recordMissed : true }
148+
149+ WithRecordMissed (true ).applyTo (got )
150+ if ! isReportConfigEquals (got , expect ) {
151+ t .Errorf ("got %+v != expect %+v" , got , expect )
152+ }
153+ }
154+
155+ // go test -v -cover -run=^TestWithRecordHit$
156+ func TestWithRecordHit (t * testing.T ) {
157+ got := & reportConfig {recordHit : false }
158+ expect := & reportConfig {recordHit : true }
159+
160+ WithRecordHit (true ).applyTo (got )
161+ if ! isReportConfigEquals (got , expect ) {
162+ t .Errorf ("got %+v != expect %+v" , got , expect )
163+ }
164+ }
165+
166+ // go test -v -cover -run=^TestWithRecordGC$
167+ func TestWithRecordGC (t * testing.T ) {
168+ got := & reportConfig {recordGC : false }
169+ expect := & reportConfig {recordGC : true }
170+
171+ WithRecordGC (true ).applyTo (got )
172+ if ! isReportConfigEquals (got , expect ) {
173+ t .Errorf ("got %+v != expect %+v" , got , expect )
174+ }
175+ }
176+
177+ // go test -v -cover -run=^TestWithRecordLoad$
178+ func TestWithRecordLoad (t * testing.T ) {
179+ got := & reportConfig {recordLoad : false }
180+ expect := & reportConfig {recordLoad : true }
181+
182+ WithRecordLoad (true ).applyTo (got )
183+ if ! isReportConfigEquals (got , expect ) {
184+ t .Errorf ("got %+v != expect %+v" , got , expect )
185+ }
186+ }
187+
144188// go test -v -cover -run=^TestWithReportMissed$
145189func TestWithReportMissed (t * testing.T ) {
146- reportMissed := func (key string ) {}
190+ reportMissed := func (reporter * Reporter , key string ) {}
147191
148192 got := & reportConfig {reportMissed : nil }
149193 expect := & reportConfig {reportMissed : reportMissed }
@@ -156,7 +200,7 @@ func TestWithReportMissed(t *testing.T) {
156200
157201// go test -v -cover -run=^TestWithReportHit$
158202func TestWithReportHit (t * testing.T ) {
159- reportHit := func (key string , value interface {}) {}
203+ reportHit := func (reporter * Reporter , key string , value interface {}) {}
160204
161205 got := & reportConfig {reportHit : nil }
162206 expect := & reportConfig {reportHit : reportHit }
@@ -169,7 +213,7 @@ func TestWithReportHit(t *testing.T) {
169213
170214// go test -v -cover -run=^TestWithReportGC$
171215func TestWithReportGC (t * testing.T ) {
172- reportGC := func (cost time.Duration , cleans int ) {}
216+ reportGC := func (reporter * Reporter , cost time.Duration , cleans int ) {}
173217
174218 got := & reportConfig {reportGC : nil }
175219 expect := & reportConfig {reportGC : reportGC }
@@ -182,7 +226,7 @@ func TestWithReportGC(t *testing.T) {
182226
183227// go test -v -cover -run=^TestWithReportLoad$
184228func TestWithReportLoad (t * testing.T ) {
185- reportLoad := func (key string , value interface {}, ttl time.Duration , err error ) {}
229+ reportLoad := func (reporter * Reporter , key string , value interface {}, ttl time.Duration , err error ) {}
186230
187231 got := & reportConfig {reportLoad : nil }
188232 expect := & reportConfig {reportLoad : reportLoad }
0 commit comments