(t *testing.T)
| 39 | } |
| 40 | |
| 41 | func TestNopCore(t *testing.T) { |
| 42 | entry := Entry{ |
| 43 | Message: "test", |
| 44 | Level: InfoLevel, |
| 45 | Time: time.Now(), |
| 46 | LoggerName: "main", |
| 47 | Stack: "fake-stack", |
| 48 | } |
| 49 | ce := &CheckedEntry{} |
| 50 | |
| 51 | allLevels := []Level{ |
| 52 | DebugLevel, |
| 53 | InfoLevel, |
| 54 | WarnLevel, |
| 55 | ErrorLevel, |
| 56 | DPanicLevel, |
| 57 | PanicLevel, |
| 58 | FatalLevel, |
| 59 | } |
| 60 | core := NewNopCore() |
| 61 | assert.Equal(t, core, core.With([]Field{makeInt64Field("k", 42)}), "Expected no-op With.") |
| 62 | for _, level := range allLevels { |
| 63 | assert.False(t, core.Enabled(level), "Expected all levels to be disabled in no-op core.") |
| 64 | assert.Equal(t, ce, core.Check(entry, ce), "Expected no-op Check to return checked entry unchanged.") |
| 65 | assert.NoError(t, core.Write(entry, nil), "Expected no-op Writes to always succeed.") |
| 66 | assert.NoError(t, core.Sync(), "Expected no-op Syncs to always succeed.") |
| 67 | } |
| 68 | } |
| 69 | |
| 70 | func TestIOCore(t *testing.T) { |
| 71 | temp, err := os.CreateTemp(t.TempDir(), "test.log") |
nothing calls this directly
no test coverage detected