From 8d323f7570805199af4cabde5eb91809ea768541 Mon Sep 17 00:00:00 2001 From: Claude Date: Thu, 2 Apr 2026 14:19:05 +0100 Subject: [PATCH] ax(logging): rename TestLoggerLevels/TestLoggerDebugLevel to TestFilename_Function_{Good,Bad,Ugly} MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit AX test naming rule: TestFilename_Function_{Good,Bad,Ugly} — all three categories mandatory. Splits the single test into the three required forms. Co-Authored-By: Charon --- pkg/logging/logger_test.go | 27 ++++++++++++++++++--------- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/pkg/logging/logger_test.go b/pkg/logging/logger_test.go index 5fa5163..ec9b55d 100644 --- a/pkg/logging/logger_test.go +++ b/pkg/logging/logger_test.go @@ -6,20 +6,14 @@ import ( "testing" ) -func TestLoggerLevels(t *testing.T) { +func TestLogger_Log_Good(t *testing.T) { var buf bytes.Buffer logger := New(Config{ Output: &buf, Level: LevelInfo, }) - // Debug should not appear at Info level - logger.Debug("debug message") - if buf.Len() > 0 { - t.Error("Debug message should not appear at Info level") - } - - // Info should appear + // Info should appear at Info level logger.Info("info message") if !strings.Contains(buf.String(), "[INFO]") { t.Error("Info message should appear") @@ -43,13 +37,28 @@ func TestLoggerLevels(t *testing.T) { } } -func TestLoggerDebugLevel(t *testing.T) { +func TestLogger_Log_Bad(t *testing.T) { + var buf bytes.Buffer + logger := New(Config{ + Output: &buf, + Level: LevelInfo, + }) + + // Debug should not appear at Info level + logger.Debug("debug message") + if buf.Len() > 0 { + t.Error("Debug message should not appear at Info level") + } +} + +func TestLogger_Log_Ugly(t *testing.T) { var buf bytes.Buffer logger := New(Config{ Output: &buf, Level: LevelDebug, }) + // All levels should appear at Debug level logger.Debug("debug message") if !strings.Contains(buf.String(), "[DEBUG]") { t.Error("Debug message should appear at Debug level")