starter/pkg/logx/log_test.go
2026-03-28 19:29:40 +08:00

111 lines
1.8 KiB
Go

package logx
import (
"context"
"testing"
)
func TestCtxError(t *testing.T) {
type args struct {
ctx context.Context
template string
args []interface{}
}
tests := []struct {
name string
args args
}{
{
name: "",
args: args{
ctx: context.Background(),
template: "你好",
args: nil,
},
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
CtxError(tt.args.ctx, tt.args.template, tt.args.args...)
})
}
}
func TestCtxWarn(t *testing.T) {
type args struct {
ctx context.Context
template string
args []interface{}
}
tests := []struct {
name string
args args
}{
{
name: "",
args: args{
ctx: context.Background(),
template: "你好 Warn",
args: nil,
},
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
CtxWarn(tt.args.ctx, tt.args.template, tt.args.args...)
})
}
}
func TestCtxDebug(t *testing.T) {
type args struct {
ctx context.Context
template string
args []interface{}
}
tests := []struct {
name string
args args
}{
{
name: "",
args: args{
ctx: context.Background(),
template: "你好 Debug",
args: nil,
},
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
CtxDebug(tt.args.ctx, tt.args.template, tt.args.args...)
})
}
}
func TestCtxInfo(t *testing.T) {
type args struct {
ctx context.Context
template string
args []interface{}
}
tests := []struct {
name string
args args
}{
{
name: "",
args: args{
ctx: context.Background(),
template: "你好呀",
args: nil,
},
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
CtxInfo(tt.args.ctx, tt.args.template, tt.args.args...)
})
}
}