(t *testing.T)
| 276 | } |
| 277 | |
| 278 | func TestDSNWithCustomTLSQueryEscape(t *testing.T) { |
| 279 | const configKey = "&%!:" |
| 280 | dsn := "User:password@tcp(localhost:5555)/dbname?tls=" + url.QueryEscape(configKey) |
| 281 | name := "foohost" |
| 282 | tlsCfg := tls.Config{ServerName: name} |
| 283 | |
| 284 | RegisterTLSConfig(configKey, &tlsCfg) |
| 285 | defer DeregisterTLSConfig(configKey) |
| 286 | |
| 287 | cfg, err := ParseDSN(dsn) |
| 288 | |
| 289 | if err != nil { |
| 290 | t.Error(err.Error()) |
| 291 | } else if cfg.TLS.ServerName != name { |
| 292 | t.Errorf("did not get the correct TLS ServerName (%s) parsing DSN (%s).", name, dsn) |
| 293 | } |
| 294 | } |
| 295 | |
| 296 | func TestDSNUnsafeCollation(t *testing.T) { |
| 297 | _, err := ParseDSN("/dbname?collation=gbk_chinese_ci&interpolateParams=true") |
nothing calls this directly
no test coverage detected