(t *testing.T)
| 128 | } |
| 129 | |
| 130 | func TestIOCoreSyncsOutput(t *testing.T) { |
| 131 | tests := []struct { |
| 132 | entry Entry |
| 133 | shouldSync bool |
| 134 | }{ |
| 135 | {Entry{Level: DebugLevel}, false}, |
| 136 | {Entry{Level: InfoLevel}, false}, |
| 137 | {Entry{Level: WarnLevel}, false}, |
| 138 | {Entry{Level: ErrorLevel}, false}, |
| 139 | {Entry{Level: DPanicLevel}, true}, |
| 140 | {Entry{Level: PanicLevel}, true}, |
| 141 | {Entry{Level: FatalLevel}, true}, |
| 142 | } |
| 143 | |
| 144 | for _, tt := range tests { |
| 145 | sink := &ztest.Discarder{} |
| 146 | core := NewCore( |
| 147 | NewJSONEncoder(testEncoderConfig()), |
| 148 | sink, |
| 149 | DebugLevel, |
| 150 | ) |
| 151 | |
| 152 | assert.NoError(t, core.Write(tt.entry, nil), "Unexpected error writing entry.") |
| 153 | assert.Equal(t, tt.shouldSync, sink.Called(), "Incorrect Sync behavior.") |
| 154 | } |
| 155 | } |
| 156 | |
| 157 | func TestIOCoreWriteFailure(t *testing.T) { |
| 158 | core := NewCore( |
nothing calls this directly
no test coverage detected