mirror of
https://github.com/router-for-me/CLIProxyAPI.git
synced 2026-06-23 21:00:29 +08:00
28 lines
631 B
Go
28 lines
631 B
Go
package logging
|
|
|
|
import (
|
|
"strings"
|
|
"testing"
|
|
"time"
|
|
|
|
log "github.com/sirupsen/logrus"
|
|
)
|
|
|
|
func TestLogFormatterPrintsVersionField(t *testing.T) {
|
|
entry := log.NewEntry(log.New())
|
|
entry.Time = time.Date(2026, 6, 9, 11, 10, 2, 0, time.Local)
|
|
entry.Level = log.InfoLevel
|
|
entry.Message = "fetched latest antigravity version"
|
|
entry.Data["version"] = "2.1.0"
|
|
|
|
formatted, errFormat := (&LogFormatter{}).Format(entry)
|
|
if errFormat != nil {
|
|
t.Fatalf("Format() error = %v", errFormat)
|
|
}
|
|
|
|
line := string(formatted)
|
|
if !strings.Contains(line, "version=2.1.0") {
|
|
t.Fatalf("formatted line %q missing version field", line)
|
|
}
|
|
}
|