调整SetOptions的方式

This commit is contained in:
Yun
2025-11-21 15:54:49 +08:00
parent 04bdd98d6f
commit eeaa518fc3
17 changed files with 90 additions and 86 deletions
+3 -3
View File
@@ -15,13 +15,13 @@ func TestSmtpEnhanced(t *testing.T) {
ctx := context.Background()
// 测试空配置
_, err := smtp.SetOption(ctx)
err := smtp.SetOption(ctx)
if err == nil {
t.Error("Expected error for empty config")
}
// 测试不完整配置
_, err = smtp.SetOption(ctx, func(opt *interfaces.Options) {
err = smtp.SetOption(ctx, func(opt *interfaces.Options) {
opt.Smtp = &interfaces.EmailConfigDataSmtp{
Host: "smtp.example.com",
// 缺少用户名和密码
@@ -32,7 +32,7 @@ func TestSmtpEnhanced(t *testing.T) {
}
// 测试完整配置
_, err = smtp.SetOption(ctx, func(opt *interfaces.Options) {
err = smtp.SetOption(ctx, func(opt *interfaces.Options) {
opt.Smtp = &interfaces.EmailConfigDataSmtp{
Host: "smtp.example.com",
Port: "587",