go/tests/log_test.go
Snider 1ca010e1fb test: rewrite test suite for AX primitives API
164 tests, 41.3% coverage. Tests written against the public API only
(external test package, no _test.go in pkg/core/).

Covers: New(Options), Data, Drive, Config, Service, Error, IPC,
Fs, Cli, Lock, Array, Log, App, Runtime, Task.

Fixes: NewCommand now inits flagset, New() wires Cli root command.

Old tests removed — they referenced With*, RegisterService, and
other patterns that no longer exist.

Co-Authored-By: Virgil <virgil@lethean.io>
2026-03-20 08:42:38 +00:00

37 lines
772 B
Go

package core_test
import (
"testing"
. "forge.lthn.ai/core/go/pkg/core"
"github.com/stretchr/testify/assert"
)
// --- Log (Structured Logger) ---
func TestLog_New_Good(t *testing.T) {
l := NewLog(LogOpts{Level: LevelInfo})
assert.NotNil(t, l)
}
func TestLog_Levels_Good(t *testing.T) {
for _, level := range []Level{LevelDebug, LevelInfo, LevelWarn, LevelError} {
l := NewLog(LogOpts{Level: level})
l.Debug("debug msg")
l.Info("info msg")
l.Warn("warn msg")
l.Error("error msg")
}
}
func TestLog_CoreLog_Good(t *testing.T) {
c := New()
assert.NotNil(t, c.Log())
}
func TestLog_ErrorSink_Interface(t *testing.T) {
l := NewLog(LogOpts{Level: LevelInfo})
var sink ErrorSink = l
sink.Error("test", "key", "val")
sink.Warn("test", "key", "val")
}