111 lines
1.8 KiB
Go
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...)
|
|
})
|
|
}
|
|
}
|