@@ -12,37 +12,35 @@ import (
1212)
1313
1414func Test_collectorCore_Enabled (t * testing.T ) {
15- cc := collectorCore { core : newBufferedCore (zapcore .InfoLevel )}
15+ cc := newCollectorCore ( newBufferedCore (zapcore .InfoLevel ))
1616 assert .True (t , cc .Enabled (zapcore .ErrorLevel ))
1717 assert .False (t , cc .Enabled (zapcore .DebugLevel ))
1818}
1919
2020func Test_collectorCore_Check (t * testing.T ) {
2121 t .Run ("check passed" , func (t * testing.T ) {
2222 bc := newBufferedCore (zapcore .InfoLevel )
23- cc := collectorCore { core : bc }
23+ cc := newCollectorCore ( bc )
2424 e := zapcore.Entry {
2525 Level : zapcore .InfoLevel ,
2626 }
2727 expected := & zapcore.CheckedEntry {}
28- expected = expected .AddCore (e , & cc )
29- ce := cc .Check (e , nil )
30- assert .Equal (t , expected , ce )
28+ expected = expected .AddCore (e , bc )
29+ assert .Equal (t , expected , cc .Check (e , nil ))
3130 })
3231
3332 t .Run ("check did not pass" , func (t * testing.T ) {
34- cc := collectorCore { core : newBufferedCore (zapcore .InfoLevel )}
33+ cc := newCollectorCore ( newBufferedCore (zapcore .InfoLevel ))
3534 e := zapcore.Entry {
3635 Level : zapcore .DebugLevel ,
3736 }
38- ce := cc .Check (e , nil )
39- assert .Nil (t , ce )
37+ assert .Nil (t , cc .Check (e , nil ))
4038 })
4139}
4240
4341func Test_collectorCore_With (t * testing.T ) {
44- cc := collectorCore { core : newBufferedCore (zapcore .InfoLevel )}
45- cc .core .(* bufferedCore ).context = []zapcore.Field {
42+ cc := newCollectorCore ( newBufferedCore (zapcore .InfoLevel ))
43+ cc .loadDelegate () .(* bufferedCore ).context = []zapcore.Field {
4644 {Key : "original" , String : "context" },
4745 }
4846 inputs := []zapcore.Field {
@@ -53,11 +51,11 @@ func Test_collectorCore_With(t *testing.T) {
5351 {Key : "test" , String : "passed" },
5452 }
5553 newCC := cc .With (inputs )
56- assert .Equal (t , expected , newCC .(* collectorCore ).core .(* bufferedCore ).context )
54+ assert .Equal (t , expected , newCC .(* collectorCore ).loadDelegate () .(* bufferedCore ).context )
5755}
5856
5957func Test_collectorCore_Write (t * testing.T ) {
60- cc := collectorCore { core : newBufferedCore (zapcore .InfoLevel )}
58+ cc := newCollectorCore ( newBufferedCore (zapcore .InfoLevel ))
6159 e := zapcore.Entry {
6260 Level : zapcore .DebugLevel ,
6361 Message : "test" ,
@@ -72,18 +70,18 @@ func Test_collectorCore_Write(t *testing.T) {
7270 e ,
7371 fields ,
7472 }
75- require .Len (t , cc .core .(* bufferedCore ).logs , 1 )
76- require .Equal (t , expected , cc .core .(* bufferedCore ).logs [0 ])
73+ require .Len (t , cc .loadDelegate () .(* bufferedCore ).logs , 1 )
74+ require .Equal (t , expected , cc .loadDelegate () .(* bufferedCore ).logs [0 ])
7775}
7876
7977func Test_collectorCore_Sync (t * testing.T ) {
80- cc := collectorCore { core : newBufferedCore (zapcore .InfoLevel )}
78+ cc := newCollectorCore ( newBufferedCore (zapcore .InfoLevel ))
8179 assert .NoError (t , cc .Sync ())
8280}
8381
8482func Test_collectorCore_SetCore (t * testing.T ) {
85- cc := collectorCore { core : newBufferedCore (zapcore .InfoLevel )}
83+ cc := newCollectorCore ( newBufferedCore (zapcore .InfoLevel ))
8684 newCore := newBufferedCore (zapcore .DebugLevel )
8785 cc .SetCore (newCore )
88- assert .Equal (t , zapcore .DebugLevel , cc .core .(* bufferedCore ).LevelEnabler )
86+ assert .Equal (t , zapcore .DebugLevel , cc .loadDelegate () .(* bufferedCore ).LevelEnabler )
8987}
0 commit comments