| 1055 | } |
| 1056 | |
| 1057 | func TestPanicDisabled(t *testing.T) { |
| 1058 | out := &bytes.Buffer{} |
| 1059 | log := New(out).Level(Disabled) // Disable all levels |
| 1060 | |
| 1061 | // Call Panic, which should be disabled, call done, and panic with "" |
| 1062 | defer func() { |
| 1063 | if r := recover(); r == nil || r != "" { |
| 1064 | t.Errorf("Expected panic with empty string when Panic is disabled, got %v", r) |
| 1065 | } |
| 1066 | }() |
| 1067 | e := log.Panic() |
| 1068 | if e != nil { |
| 1069 | t.Error("Expected nil event when Panic is disabled") |
| 1070 | } |
| 1071 | if out.Len() > 0 { |
| 1072 | t.Errorf("Expected no output when Panic is disabled, got: %s", out.String()) |
| 1073 | } |
| 1074 | } |
| 1075 | |
| 1076 | func TestLoggerShouldWithNilWriter(t *testing.T) { |
| 1077 | // Create a logger with nil writer to test the should method's nil check |